@fresh-editor/fresh-editor 0.2.17 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +144 -0
- package/package.json +1 -1
- package/plugins/astro-lsp.ts +118 -0
- package/plugins/bash-lsp.ts +161 -0
- package/plugins/clojure-lsp.ts +125 -0
- package/plugins/cmake-lsp.ts +138 -0
- package/plugins/config-schema.json +275 -29
- package/plugins/dart-lsp.ts +144 -0
- package/plugins/diagnostics_panel.ts +4 -12
- package/plugins/diff_nav.i18n.json +128 -0
- package/plugins/diff_nav.ts +196 -0
- package/plugins/elixir-lsp.ts +120 -0
- package/plugins/erlang-lsp.ts +121 -0
- package/plugins/fsharp-lsp.ts +125 -0
- package/plugins/git_gutter.ts +5 -0
- package/plugins/gleam-lsp.ts +124 -0
- package/plugins/graphql-lsp.ts +139 -0
- package/plugins/haskell-lsp.ts +125 -0
- package/plugins/julia-lsp.ts +111 -0
- package/plugins/kotlin-lsp.ts +162 -0
- package/plugins/lib/finder.ts +19 -12
- package/plugins/lib/fresh.d.ts +30 -1
- package/plugins/lua-lsp.ts +161 -0
- package/plugins/nim-lsp.ts +118 -0
- package/plugins/nix-lsp.ts +125 -0
- package/plugins/nushell-lsp.ts +144 -0
- package/plugins/ocaml-lsp.ts +119 -0
- package/plugins/perl-lsp.ts +118 -0
- package/plugins/php-lsp.ts +165 -0
- package/plugins/pkg.ts +37 -76
- package/plugins/protobuf-lsp.ts +144 -0
- package/plugins/r-lsp.ts +118 -0
- package/plugins/ruby-lsp.ts +165 -0
- package/plugins/scala-lsp.ts +119 -0
- package/plugins/schemas/package.schema.json +437 -272
- package/plugins/schemas/theme.schema.json +18 -0
- package/plugins/solidity-lsp.ts +130 -0
- package/plugins/sql-lsp.ts +129 -0
- package/plugins/svelte-lsp.ts +119 -0
- package/plugins/swift-lsp.ts +120 -0
- package/plugins/tailwindcss-lsp.ts +119 -0
- package/plugins/terraform-lsp.ts +144 -0
- package/plugins/theme_editor.i18n.json +70 -14
- package/plugins/theme_editor.ts +71 -39
- package/plugins/toml-lsp.ts +162 -0
- package/plugins/typst-lsp.ts +165 -0
- package/plugins/vue-lsp.ts +118 -0
- package/plugins/yaml-lsp.ts +163 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Typst LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Provides user-friendly error handling for Typst LSP server issues.
|
|
8
|
+
* When tinymist fails to start, this plugin shows an actionable
|
|
9
|
+
* popup with installation instructions.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Detects Typst LSP server errors (tinymist)
|
|
13
|
+
* - Shows popup with install commands (cargo, brew, etc.)
|
|
14
|
+
* - Allows copying install commands to clipboard
|
|
15
|
+
* - Provides option to disable Typst LSP
|
|
16
|
+
*
|
|
17
|
+
* Alternatives:
|
|
18
|
+
* - typst-lsp: Original Typst LSP (superseded by tinymist)
|
|
19
|
+
*
|
|
20
|
+
* Notes:
|
|
21
|
+
* - Tinymist also provides PDF preview and export features
|
|
22
|
+
* - Also available as VS Code extension "Tinymist Typst"
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
interface LspServerErrorData {
|
|
26
|
+
language: string;
|
|
27
|
+
server_command: string;
|
|
28
|
+
error_type: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface LspStatusClickedData {
|
|
33
|
+
language: string;
|
|
34
|
+
has_error: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface ActionPopupResultData {
|
|
38
|
+
popup_id: string;
|
|
39
|
+
action_id: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Install commands for Typst LSP server (tinymist)
|
|
43
|
+
// See: https://github.com/Myriad-Dreamin/tinymist
|
|
44
|
+
const INSTALL_COMMANDS = {
|
|
45
|
+
cargo: "cargo install tinymist",
|
|
46
|
+
brew: "brew install tinymist",
|
|
47
|
+
nix: "nix-env -iA nixpkgs.tinymist",
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Track error state for Typst LSP
|
|
51
|
+
let typstLspError: { serverCommand: string; message: string } | null = null;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Handle LSP server errors for Typst
|
|
55
|
+
*/
|
|
56
|
+
function on_typst_lsp_server_error(data: LspServerErrorData): void {
|
|
57
|
+
// Only handle Typst language errors
|
|
58
|
+
if (data.language !== "typst") {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
editor.debug(`typst-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
63
|
+
|
|
64
|
+
// Store error state for later reference
|
|
65
|
+
typstLspError = {
|
|
66
|
+
serverCommand: data.server_command,
|
|
67
|
+
message: data.message,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Show a status message for immediate feedback
|
|
71
|
+
if (data.error_type === "not_found") {
|
|
72
|
+
editor.setStatus(
|
|
73
|
+
`Typst LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
editor.setStatus(`Typst LSP error: ${data.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
registerHandler("on_typst_lsp_server_error", on_typst_lsp_server_error);
|
|
80
|
+
|
|
81
|
+
// Register hook for LSP server errors
|
|
82
|
+
editor.on("lsp_server_error", "on_typst_lsp_server_error");
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Handle status bar click when there's a Typst LSP error
|
|
86
|
+
*/
|
|
87
|
+
function on_typst_lsp_status_clicked(
|
|
88
|
+
data: LspStatusClickedData
|
|
89
|
+
): void {
|
|
90
|
+
// Only handle Typst language clicks when there's an error
|
|
91
|
+
if (data.language !== "typst" || !typstLspError) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
editor.debug("typst-lsp: Status clicked, showing help popup");
|
|
96
|
+
|
|
97
|
+
// Show action popup with install options
|
|
98
|
+
editor.showActionPopup({
|
|
99
|
+
id: "typst-lsp-help",
|
|
100
|
+
title: "Typst Language Server Not Found",
|
|
101
|
+
message: `"${typstLspError.serverCommand}" provides code completion, diagnostics, and preview support for Typst documents. Copy a command below to install it, or visit https://github.com/Myriad-Dreamin/tinymist for details and pre-built binaries. Also available as the "Tinymist Typst" VS Code extension.`,
|
|
102
|
+
actions: [
|
|
103
|
+
{ id: "copy_cargo", label: `Copy: ${INSTALL_COMMANDS.cargo}` },
|
|
104
|
+
{ id: "copy_brew", label: `Copy: ${INSTALL_COMMANDS.brew}` },
|
|
105
|
+
{ id: "copy_nix", label: `Copy: ${INSTALL_COMMANDS.nix}` },
|
|
106
|
+
{ id: "disable", label: "Disable Typst LSP" },
|
|
107
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
registerHandler("on_typst_lsp_status_clicked", on_typst_lsp_status_clicked);
|
|
112
|
+
|
|
113
|
+
// Register hook for status bar clicks
|
|
114
|
+
editor.on("lsp_status_clicked", "on_typst_lsp_status_clicked");
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Handle action popup results for Typst LSP help
|
|
118
|
+
*/
|
|
119
|
+
function on_typst_lsp_action_result(
|
|
120
|
+
data: ActionPopupResultData
|
|
121
|
+
): void {
|
|
122
|
+
// Only handle our popup
|
|
123
|
+
if (data.popup_id !== "typst-lsp-help") {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
editor.debug(`typst-lsp: Action selected - ${data.action_id}`);
|
|
128
|
+
|
|
129
|
+
switch (data.action_id) {
|
|
130
|
+
case "copy_cargo":
|
|
131
|
+
editor.setClipboard(INSTALL_COMMANDS.cargo);
|
|
132
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.cargo);
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case "copy_brew":
|
|
136
|
+
editor.setClipboard(INSTALL_COMMANDS.brew);
|
|
137
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.brew);
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case "copy_nix":
|
|
141
|
+
editor.setClipboard(INSTALL_COMMANDS.nix);
|
|
142
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.nix);
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
case "disable":
|
|
146
|
+
editor.disableLspForLanguage("typst");
|
|
147
|
+
editor.setStatus("Typst LSP disabled");
|
|
148
|
+
typstLspError = null;
|
|
149
|
+
break;
|
|
150
|
+
|
|
151
|
+
case "dismiss":
|
|
152
|
+
case "dismissed":
|
|
153
|
+
// Just close the popup without action
|
|
154
|
+
break;
|
|
155
|
+
|
|
156
|
+
default:
|
|
157
|
+
editor.debug(`typst-lsp: Unknown action: ${data.action_id}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
registerHandler("on_typst_lsp_action_result", on_typst_lsp_action_result);
|
|
161
|
+
|
|
162
|
+
// Register hook for action popup results
|
|
163
|
+
editor.on("action_popup_result", "on_typst_lsp_action_result");
|
|
164
|
+
|
|
165
|
+
editor.debug("typst-lsp: Plugin loaded");
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Vue LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Server: vue-language-server (@vue/language-server, formerly Volar)
|
|
8
|
+
* VS Code: "Vue - Official" extension (replaces deprecated Vetur)
|
|
9
|
+
* Neovim: nvim-lspconfig volar
|
|
10
|
+
* Note: Supports hybrid mode with @vue/typescript-plugin for TS integration
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface LspServerErrorData {
|
|
14
|
+
language: string;
|
|
15
|
+
server_command: string;
|
|
16
|
+
error_type: string;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface LspStatusClickedData {
|
|
21
|
+
language: string;
|
|
22
|
+
has_error: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ActionPopupResultData {
|
|
26
|
+
popup_id: string;
|
|
27
|
+
action_id: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const INSTALL_COMMANDS = {
|
|
31
|
+
npm: "npm install -g @vue/language-server",
|
|
32
|
+
yarn: "yarn global add @vue/language-server",
|
|
33
|
+
pnpm: "pnpm add -g @vue/language-server",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
let vueLspError: { serverCommand: string; message: string } | null = null;
|
|
37
|
+
|
|
38
|
+
function on_vue_lsp_server_error(data: LspServerErrorData): void {
|
|
39
|
+
if (data.language !== "vue") {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
editor.debug(`vue-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
44
|
+
|
|
45
|
+
vueLspError = {
|
|
46
|
+
serverCommand: data.server_command,
|
|
47
|
+
message: data.message,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (data.error_type === "not_found") {
|
|
51
|
+
editor.setStatus(
|
|
52
|
+
`Vue LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
editor.setStatus(`Vue LSP error: ${data.message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
registerHandler("on_vue_lsp_server_error", on_vue_lsp_server_error);
|
|
59
|
+
editor.on("lsp_server_error", "on_vue_lsp_server_error");
|
|
60
|
+
|
|
61
|
+
function on_vue_lsp_status_clicked(data: LspStatusClickedData): void {
|
|
62
|
+
if (data.language !== "vue" || !vueLspError) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
editor.debug("vue-lsp: Status clicked, showing help popup");
|
|
67
|
+
|
|
68
|
+
editor.showActionPopup({
|
|
69
|
+
id: "vue-lsp-help",
|
|
70
|
+
title: "Vue Language Server Not Found",
|
|
71
|
+
message: `"${vueLspError.serverCommand}" (formerly Volar) provides completion, diagnostics, and refactoring for Vue SFCs. It replaces the deprecated Vetur.\n\nFor TypeScript integration, also install @vue/typescript-plugin.\nVS Code users: Install the "Vue - Official" extension.\nSee: https://github.com/vuejs/language-tools`,
|
|
72
|
+
actions: [
|
|
73
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
74
|
+
{ id: "copy_pnpm", label: `Copy: ${INSTALL_COMMANDS.pnpm}` },
|
|
75
|
+
{ id: "disable", label: "Disable Vue LSP" },
|
|
76
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
registerHandler("on_vue_lsp_status_clicked", on_vue_lsp_status_clicked);
|
|
81
|
+
editor.on("lsp_status_clicked", "on_vue_lsp_status_clicked");
|
|
82
|
+
|
|
83
|
+
function on_vue_lsp_action_result(data: ActionPopupResultData): void {
|
|
84
|
+
if (data.popup_id !== "vue-lsp-help") {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
editor.debug(`vue-lsp: Action selected - ${data.action_id}`);
|
|
89
|
+
|
|
90
|
+
switch (data.action_id) {
|
|
91
|
+
case "copy_npm":
|
|
92
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
93
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case "copy_pnpm":
|
|
97
|
+
editor.setClipboard(INSTALL_COMMANDS.pnpm);
|
|
98
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.pnpm);
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case "disable":
|
|
102
|
+
editor.disableLspForLanguage("vue");
|
|
103
|
+
editor.setStatus("Vue LSP disabled");
|
|
104
|
+
vueLspError = null;
|
|
105
|
+
break;
|
|
106
|
+
|
|
107
|
+
case "dismiss":
|
|
108
|
+
case "dismissed":
|
|
109
|
+
break;
|
|
110
|
+
|
|
111
|
+
default:
|
|
112
|
+
editor.debug(`vue-lsp: Unknown action: ${data.action_id}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
registerHandler("on_vue_lsp_action_result", on_vue_lsp_action_result);
|
|
116
|
+
editor.on("action_popup_result", "on_vue_lsp_action_result");
|
|
117
|
+
|
|
118
|
+
editor.debug("vue-lsp: Plugin loaded");
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* YAML LSP Helper Plugin
|
|
6
|
+
*
|
|
7
|
+
* Provides user-friendly error handling for YAML LSP server issues.
|
|
8
|
+
* When yaml-language-server fails to start, this plugin shows an actionable
|
|
9
|
+
* popup with installation instructions.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Detects YAML LSP server errors (yaml-language-server)
|
|
13
|
+
* - Shows popup with install commands (npm, yarn, pnpm)
|
|
14
|
+
* - Allows copying install commands to clipboard
|
|
15
|
+
* - Provides option to disable YAML LSP
|
|
16
|
+
*
|
|
17
|
+
* Notes:
|
|
18
|
+
* - yaml-language-server supports JSON Schema validation via modeline comments
|
|
19
|
+
* e.g. # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
20
|
+
* - Built-in Kubernetes schema support
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
interface LspServerErrorData {
|
|
24
|
+
language: string;
|
|
25
|
+
server_command: string;
|
|
26
|
+
error_type: string;
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface LspStatusClickedData {
|
|
31
|
+
language: string;
|
|
32
|
+
has_error: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface ActionPopupResultData {
|
|
36
|
+
popup_id: string;
|
|
37
|
+
action_id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Install commands for YAML LSP server (yaml-language-server)
|
|
41
|
+
// See: https://github.com/redhat-developer/yaml-language-server
|
|
42
|
+
const INSTALL_COMMANDS = {
|
|
43
|
+
npm: "npm i -g yaml-language-server",
|
|
44
|
+
yarn: "yarn global add yaml-language-server",
|
|
45
|
+
pnpm: "pnpm add -g yaml-language-server",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Track error state for YAML LSP
|
|
49
|
+
let yamlLspError: { serverCommand: string; message: string } | null = null;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Handle LSP server errors for YAML
|
|
53
|
+
*/
|
|
54
|
+
function on_yaml_lsp_server_error(data: LspServerErrorData): void {
|
|
55
|
+
// Only handle YAML language errors
|
|
56
|
+
if (data.language !== "yaml") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
editor.debug(`yaml-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
61
|
+
|
|
62
|
+
// Store error state for later reference
|
|
63
|
+
yamlLspError = {
|
|
64
|
+
serverCommand: data.server_command,
|
|
65
|
+
message: data.message,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Show a status message for immediate feedback
|
|
69
|
+
if (data.error_type === "not_found") {
|
|
70
|
+
editor.setStatus(
|
|
71
|
+
`YAML LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
editor.setStatus(`YAML LSP error: ${data.message}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
registerHandler("on_yaml_lsp_server_error", on_yaml_lsp_server_error);
|
|
78
|
+
|
|
79
|
+
// Register hook for LSP server errors
|
|
80
|
+
editor.on("lsp_server_error", "on_yaml_lsp_server_error");
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Handle status bar click when there's a YAML LSP error
|
|
84
|
+
*/
|
|
85
|
+
function on_yaml_lsp_status_clicked(
|
|
86
|
+
data: LspStatusClickedData
|
|
87
|
+
): void {
|
|
88
|
+
// Only handle YAML language clicks when there's an error
|
|
89
|
+
if (data.language !== "yaml" || !yamlLspError) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
editor.debug("yaml-lsp: Status clicked, showing help popup");
|
|
94
|
+
|
|
95
|
+
// Show action popup with install options
|
|
96
|
+
editor.showActionPopup({
|
|
97
|
+
id: "yaml-lsp-help",
|
|
98
|
+
title: "YAML Language Server Not Found",
|
|
99
|
+
message: `"${yamlLspError.serverCommand}" provides code completion, validation, and schema support for YAML files. Requires Node.js. Supports JSON Schema validation and built-in Kubernetes schemas. Copy a command below to install it, or visit https://github.com/redhat-developer/yaml-language-server for details.`,
|
|
100
|
+
actions: [
|
|
101
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
102
|
+
{ id: "copy_yarn", label: `Copy: ${INSTALL_COMMANDS.yarn}` },
|
|
103
|
+
{ id: "copy_pnpm", label: `Copy: ${INSTALL_COMMANDS.pnpm}` },
|
|
104
|
+
{ id: "disable", label: "Disable YAML LSP" },
|
|
105
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
registerHandler("on_yaml_lsp_status_clicked", on_yaml_lsp_status_clicked);
|
|
110
|
+
|
|
111
|
+
// Register hook for status bar clicks
|
|
112
|
+
editor.on("lsp_status_clicked", "on_yaml_lsp_status_clicked");
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Handle action popup results for YAML LSP help
|
|
116
|
+
*/
|
|
117
|
+
function on_yaml_lsp_action_result(
|
|
118
|
+
data: ActionPopupResultData
|
|
119
|
+
): void {
|
|
120
|
+
// Only handle our popup
|
|
121
|
+
if (data.popup_id !== "yaml-lsp-help") {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
editor.debug(`yaml-lsp: Action selected - ${data.action_id}`);
|
|
126
|
+
|
|
127
|
+
switch (data.action_id) {
|
|
128
|
+
case "copy_npm":
|
|
129
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
130
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
131
|
+
break;
|
|
132
|
+
|
|
133
|
+
case "copy_yarn":
|
|
134
|
+
editor.setClipboard(INSTALL_COMMANDS.yarn);
|
|
135
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.yarn);
|
|
136
|
+
break;
|
|
137
|
+
|
|
138
|
+
case "copy_pnpm":
|
|
139
|
+
editor.setClipboard(INSTALL_COMMANDS.pnpm);
|
|
140
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.pnpm);
|
|
141
|
+
break;
|
|
142
|
+
|
|
143
|
+
case "disable":
|
|
144
|
+
editor.disableLspForLanguage("yaml");
|
|
145
|
+
editor.setStatus("YAML LSP disabled");
|
|
146
|
+
yamlLspError = null;
|
|
147
|
+
break;
|
|
148
|
+
|
|
149
|
+
case "dismiss":
|
|
150
|
+
case "dismissed":
|
|
151
|
+
// Just close the popup without action
|
|
152
|
+
break;
|
|
153
|
+
|
|
154
|
+
default:
|
|
155
|
+
editor.debug(`yaml-lsp: Unknown action: ${data.action_id}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
registerHandler("on_yaml_lsp_action_result", on_yaml_lsp_action_result);
|
|
159
|
+
|
|
160
|
+
// Register hook for action popup results
|
|
161
|
+
editor.on("action_popup_result", "on_yaml_lsp_action_result");
|
|
162
|
+
|
|
163
|
+
editor.debug("yaml-lsp: Plugin loaded");
|