@involvex/fresh-editor 0.1.76 → 0.1.78
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/bin/CHANGELOG.md +1017 -0
- package/bin/LICENSE +117 -0
- package/bin/README.md +248 -0
- package/bin/fresh.exe +0 -0
- package/bin/plugins/README.md +71 -0
- package/bin/plugins/audit_mode.i18n.json +821 -0
- package/bin/plugins/audit_mode.ts +1810 -0
- package/bin/plugins/buffer_modified.i18n.json +67 -0
- package/bin/plugins/buffer_modified.ts +281 -0
- package/bin/plugins/calculator.i18n.json +93 -0
- package/bin/plugins/calculator.ts +770 -0
- package/bin/plugins/clangd-lsp.ts +168 -0
- package/bin/plugins/clangd_support.i18n.json +223 -0
- package/bin/plugins/clangd_support.md +20 -0
- package/bin/plugins/clangd_support.ts +325 -0
- package/bin/plugins/color_highlighter.i18n.json +145 -0
- package/bin/plugins/color_highlighter.ts +304 -0
- package/bin/plugins/config-schema.json +768 -0
- package/bin/plugins/csharp-lsp.ts +147 -0
- package/bin/plugins/csharp_support.i18n.json +80 -0
- package/bin/plugins/csharp_support.ts +170 -0
- package/bin/plugins/css-lsp.ts +143 -0
- package/bin/plugins/diagnostics_panel.i18n.json +236 -0
- package/bin/plugins/diagnostics_panel.ts +642 -0
- package/bin/plugins/examples/README.md +85 -0
- package/bin/plugins/examples/async_demo.ts +165 -0
- package/bin/plugins/examples/bookmarks.ts +329 -0
- package/bin/plugins/examples/buffer_query_demo.ts +110 -0
- package/bin/plugins/examples/git_grep.ts +262 -0
- package/bin/plugins/examples/hello_world.ts +93 -0
- package/bin/plugins/examples/virtual_buffer_demo.ts +116 -0
- package/bin/plugins/find_references.i18n.json +275 -0
- package/bin/plugins/find_references.ts +359 -0
- package/bin/plugins/git_blame.i18n.json +496 -0
- package/bin/plugins/git_blame.ts +707 -0
- package/bin/plugins/git_find_file.i18n.json +314 -0
- package/bin/plugins/git_find_file.ts +300 -0
- package/bin/plugins/git_grep.i18n.json +171 -0
- package/bin/plugins/git_grep.ts +191 -0
- package/bin/plugins/git_gutter.i18n.json +93 -0
- package/bin/plugins/git_gutter.ts +477 -0
- package/bin/plugins/git_log.i18n.json +481 -0
- package/bin/plugins/git_log.ts +1285 -0
- package/bin/plugins/go-lsp.ts +143 -0
- package/bin/plugins/html-lsp.ts +145 -0
- package/bin/plugins/json-lsp.ts +145 -0
- package/bin/plugins/lib/fresh.d.ts +1321 -0
- package/bin/plugins/lib/index.ts +24 -0
- package/bin/plugins/lib/navigation-controller.ts +214 -0
- package/bin/plugins/lib/panel-manager.ts +220 -0
- package/bin/plugins/lib/types.ts +72 -0
- package/bin/plugins/lib/virtual-buffer-factory.ts +130 -0
- package/bin/plugins/live_grep.i18n.json +171 -0
- package/bin/plugins/live_grep.ts +422 -0
- package/bin/plugins/markdown_compose.i18n.json +223 -0
- package/bin/plugins/markdown_compose.ts +630 -0
- package/bin/plugins/merge_conflict.i18n.json +821 -0
- package/bin/plugins/merge_conflict.ts +1810 -0
- package/bin/plugins/path_complete.i18n.json +80 -0
- package/bin/plugins/path_complete.ts +165 -0
- package/bin/plugins/python-lsp.ts +162 -0
- package/bin/plugins/rust-lsp.ts +166 -0
- package/bin/plugins/search_replace.i18n.json +405 -0
- package/bin/plugins/search_replace.ts +484 -0
- package/bin/plugins/test_i18n.i18n.json +67 -0
- package/bin/plugins/test_i18n.ts +18 -0
- package/bin/plugins/theme_editor.i18n.json +3746 -0
- package/bin/plugins/theme_editor.ts +2063 -0
- package/bin/plugins/todo_highlighter.i18n.json +184 -0
- package/bin/plugins/todo_highlighter.ts +206 -0
- package/bin/plugins/typescript-lsp.ts +167 -0
- package/bin/plugins/vi_mode.i18n.json +1549 -0
- package/bin/plugins/vi_mode.ts +2747 -0
- package/bin/plugins/welcome.i18n.json +236 -0
- package/bin/plugins/welcome.ts +76 -0
- package/bin/themes/dark.json +102 -0
- package/bin/themes/dracula.json +62 -0
- package/bin/themes/high-contrast.json +102 -0
- package/bin/themes/light.json +102 -0
- package/bin/themes/nord.json +62 -0
- package/bin/themes/nostalgia.json +102 -0
- package/bin/themes/solarized-dark.json +62 -0
- package/binary-install.js +1 -1
- package/dist/bin/fresh.js +9 -0
- package/dist/binary-install.js +149 -0
- package/dist/binary.js +30 -0
- package/dist/fresh-6yhknp07.exe +0 -0
- package/dist/install.js +158 -0
- package/dist/run-fresh.js +43 -0
- package/package.json +7 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Go LSP Helper Plugin
|
|
7
|
+
*
|
|
8
|
+
* Provides user-friendly error handling for Go LSP server issues.
|
|
9
|
+
* When gopls fails to start, this plugin shows an actionable
|
|
10
|
+
* popup with installation instructions.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Detects Go LSP server errors (gopls)
|
|
14
|
+
* - Shows popup with install commands
|
|
15
|
+
* - Allows copying install commands to clipboard
|
|
16
|
+
* - Provides option to disable Go LSP
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface LspServerErrorData {
|
|
20
|
+
language: string;
|
|
21
|
+
server_command: string;
|
|
22
|
+
error_type: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface LspStatusClickedData {
|
|
27
|
+
language: string;
|
|
28
|
+
has_error: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ActionPopupResultData {
|
|
32
|
+
popup_id: string;
|
|
33
|
+
action_id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Install commands for Go LSP server (gopls)
|
|
37
|
+
// go install is the official recommended method
|
|
38
|
+
// See: https://pkg.go.dev/golang.org/x/tools/gopls
|
|
39
|
+
const INSTALL_COMMANDS = {
|
|
40
|
+
go: "go install golang.org/x/tools/gopls@latest",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Track error state for Go LSP
|
|
44
|
+
let goLspError: { serverCommand: string; message: string } | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handle LSP server errors for Go
|
|
48
|
+
*/
|
|
49
|
+
globalThis.on_go_lsp_server_error = function (data: LspServerErrorData): void {
|
|
50
|
+
// Only handle Go language errors
|
|
51
|
+
if (data.language !== "go") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
editor.debug(`go-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
56
|
+
|
|
57
|
+
// Store error state for later reference
|
|
58
|
+
goLspError = {
|
|
59
|
+
serverCommand: data.server_command,
|
|
60
|
+
message: data.message,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Show a status message for immediate feedback
|
|
64
|
+
if (data.error_type === "not_found") {
|
|
65
|
+
editor.setStatus(
|
|
66
|
+
`Go LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
editor.setStatus(`Go LSP error: ${data.message}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Register hook for LSP server errors
|
|
74
|
+
editor.on("lsp_server_error", "on_go_lsp_server_error");
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Handle status bar click when there's a Go LSP error
|
|
78
|
+
*/
|
|
79
|
+
globalThis.on_go_lsp_status_clicked = function (
|
|
80
|
+
data: LspStatusClickedData
|
|
81
|
+
): void {
|
|
82
|
+
// Only handle Go language clicks when there's an error
|
|
83
|
+
if (data.language !== "go" || !goLspError) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
editor.debug("go-lsp: Status clicked, showing help popup");
|
|
88
|
+
|
|
89
|
+
// Show action popup with install options
|
|
90
|
+
editor.showActionPopup({
|
|
91
|
+
id: "go-lsp-help",
|
|
92
|
+
title: "Go Language Server Not Found",
|
|
93
|
+
message: `"${goLspError.serverCommand}" provides code completion, diagnostics, and navigation for Go files. Copy the command below to install it.`,
|
|
94
|
+
actions: [
|
|
95
|
+
{ id: "copy_go", label: `Copy: ${INSTALL_COMMANDS.go}` },
|
|
96
|
+
{ id: "disable", label: "Disable Go LSP" },
|
|
97
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Register hook for status bar clicks
|
|
103
|
+
editor.on("lsp_status_clicked", "on_go_lsp_status_clicked");
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Handle action popup results for Go LSP help
|
|
107
|
+
*/
|
|
108
|
+
globalThis.on_go_lsp_action_result = function (
|
|
109
|
+
data: ActionPopupResultData
|
|
110
|
+
): void {
|
|
111
|
+
// Only handle our popup
|
|
112
|
+
if (data.popup_id !== "go-lsp-help") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
editor.debug(`go-lsp: Action selected - ${data.action_id}`);
|
|
117
|
+
|
|
118
|
+
switch (data.action_id) {
|
|
119
|
+
case "copy_go":
|
|
120
|
+
editor.setClipboard(INSTALL_COMMANDS.go);
|
|
121
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.go);
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case "disable":
|
|
125
|
+
editor.disableLspForLanguage("go");
|
|
126
|
+
editor.setStatus("Go LSP disabled");
|
|
127
|
+
goLspError = null;
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case "dismiss":
|
|
131
|
+
case "dismissed":
|
|
132
|
+
// Just close the popup without action
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
default:
|
|
136
|
+
editor.debug(`go-lsp: Unknown action: ${data.action_id}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Register hook for action popup results
|
|
141
|
+
editor.on("action_popup_result", "on_go_lsp_action_result");
|
|
142
|
+
|
|
143
|
+
editor.debug("go-lsp: Plugin loaded");
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* HTML LSP Helper Plugin
|
|
7
|
+
*
|
|
8
|
+
* Provides user-friendly error handling for HTML LSP server issues.
|
|
9
|
+
* When the HTML language server fails to start, this plugin shows an
|
|
10
|
+
* actionable popup with installation instructions.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Detects HTML LSP server errors
|
|
14
|
+
* - Shows popup with install commands (npm)
|
|
15
|
+
* - Allows copying install commands to clipboard
|
|
16
|
+
* - Provides option to disable HTML LSP
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface LspServerErrorData {
|
|
20
|
+
language: string;
|
|
21
|
+
server_command: string;
|
|
22
|
+
error_type: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface LspStatusClickedData {
|
|
27
|
+
language: string;
|
|
28
|
+
has_error: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ActionPopupResultData {
|
|
32
|
+
popup_id: string;
|
|
33
|
+
action_id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Install commands for HTML LSP server
|
|
37
|
+
// vscode-langservers-extracted provides HTML, CSS, and JSON language servers
|
|
38
|
+
// See: https://www.npmjs.com/package/vscode-langservers-extracted
|
|
39
|
+
const INSTALL_COMMANDS = {
|
|
40
|
+
npm: "npm install -g vscode-langservers-extracted",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Track error state for HTML LSP
|
|
44
|
+
let htmlLspError: { serverCommand: string; message: string } | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handle LSP server errors for HTML
|
|
48
|
+
*/
|
|
49
|
+
globalThis.on_html_lsp_server_error = function (
|
|
50
|
+
data: LspServerErrorData
|
|
51
|
+
): void {
|
|
52
|
+
// Only handle HTML language errors
|
|
53
|
+
if (data.language !== "html") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
editor.debug(`html-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
58
|
+
|
|
59
|
+
// Store error state for later reference
|
|
60
|
+
htmlLspError = {
|
|
61
|
+
serverCommand: data.server_command,
|
|
62
|
+
message: data.message,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Show a status message for immediate feedback
|
|
66
|
+
if (data.error_type === "not_found") {
|
|
67
|
+
editor.setStatus(
|
|
68
|
+
`HTML LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
69
|
+
);
|
|
70
|
+
} else {
|
|
71
|
+
editor.setStatus(`HTML LSP error: ${data.message}`);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Register hook for LSP server errors
|
|
76
|
+
editor.on("lsp_server_error", "on_html_lsp_server_error");
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Handle status bar click when there's an HTML LSP error
|
|
80
|
+
*/
|
|
81
|
+
globalThis.on_html_lsp_status_clicked = function (
|
|
82
|
+
data: LspStatusClickedData
|
|
83
|
+
): void {
|
|
84
|
+
// Only handle HTML language clicks when there's an error
|
|
85
|
+
if (data.language !== "html" || !htmlLspError) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
editor.debug("html-lsp: Status clicked, showing help popup");
|
|
90
|
+
|
|
91
|
+
// Show action popup with install options
|
|
92
|
+
editor.showActionPopup({
|
|
93
|
+
id: "html-lsp-help",
|
|
94
|
+
title: "HTML Language Server Not Found",
|
|
95
|
+
message: `"${htmlLspError.serverCommand}" provides code completion, diagnostics, and formatting for HTML files. Copy the command below to install it.`,
|
|
96
|
+
actions: [
|
|
97
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
98
|
+
{ id: "disable", label: "Disable HTML LSP" },
|
|
99
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Register hook for status bar clicks
|
|
105
|
+
editor.on("lsp_status_clicked", "on_html_lsp_status_clicked");
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handle action popup results for HTML LSP help
|
|
109
|
+
*/
|
|
110
|
+
globalThis.on_html_lsp_action_result = function (
|
|
111
|
+
data: ActionPopupResultData
|
|
112
|
+
): void {
|
|
113
|
+
// Only handle our popup
|
|
114
|
+
if (data.popup_id !== "html-lsp-help") {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
editor.debug(`html-lsp: Action selected - ${data.action_id}`);
|
|
119
|
+
|
|
120
|
+
switch (data.action_id) {
|
|
121
|
+
case "copy_npm":
|
|
122
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
123
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case "disable":
|
|
127
|
+
editor.disableLspForLanguage("html");
|
|
128
|
+
editor.setStatus("HTML LSP disabled");
|
|
129
|
+
htmlLspError = null;
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case "dismiss":
|
|
133
|
+
case "dismissed":
|
|
134
|
+
// Just close the popup without action
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
editor.debug(`html-lsp: Unknown action: ${data.action_id}`);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Register hook for action popup results
|
|
143
|
+
editor.on("action_popup_result", "on_html_lsp_action_result");
|
|
144
|
+
|
|
145
|
+
editor.debug("html-lsp: Plugin loaded");
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* JSON LSP Helper Plugin
|
|
7
|
+
*
|
|
8
|
+
* Provides user-friendly error handling for JSON LSP server issues.
|
|
9
|
+
* When the JSON language server fails to start, this plugin shows an
|
|
10
|
+
* actionable popup with installation instructions.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Detects JSON LSP server errors
|
|
14
|
+
* - Shows popup with install commands (npm)
|
|
15
|
+
* - Allows copying install commands to clipboard
|
|
16
|
+
* - Provides option to disable JSON LSP
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface LspServerErrorData {
|
|
20
|
+
language: string;
|
|
21
|
+
server_command: string;
|
|
22
|
+
error_type: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface LspStatusClickedData {
|
|
27
|
+
language: string;
|
|
28
|
+
has_error: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ActionPopupResultData {
|
|
32
|
+
popup_id: string;
|
|
33
|
+
action_id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Install commands for JSON LSP server
|
|
37
|
+
// vscode-langservers-extracted provides HTML, CSS, and JSON language servers
|
|
38
|
+
// See: https://www.npmjs.com/package/vscode-langservers-extracted
|
|
39
|
+
const INSTALL_COMMANDS = {
|
|
40
|
+
npm: "npm install -g vscode-langservers-extracted",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Track error state for JSON LSP
|
|
44
|
+
let jsonLspError: { serverCommand: string; message: string } | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handle LSP server errors for JSON
|
|
48
|
+
*/
|
|
49
|
+
globalThis.on_json_lsp_server_error = function (
|
|
50
|
+
data: LspServerErrorData
|
|
51
|
+
): void {
|
|
52
|
+
// Only handle JSON language errors
|
|
53
|
+
if (data.language !== "json") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
editor.debug(`json-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
58
|
+
|
|
59
|
+
// Store error state for later reference
|
|
60
|
+
jsonLspError = {
|
|
61
|
+
serverCommand: data.server_command,
|
|
62
|
+
message: data.message,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Show a status message for immediate feedback
|
|
66
|
+
if (data.error_type === "not_found") {
|
|
67
|
+
editor.setStatus(
|
|
68
|
+
`JSON LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
69
|
+
);
|
|
70
|
+
} else {
|
|
71
|
+
editor.setStatus(`JSON LSP error: ${data.message}`);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Register hook for LSP server errors
|
|
76
|
+
editor.on("lsp_server_error", "on_json_lsp_server_error");
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Handle status bar click when there's a JSON LSP error
|
|
80
|
+
*/
|
|
81
|
+
globalThis.on_json_lsp_status_clicked = function (
|
|
82
|
+
data: LspStatusClickedData
|
|
83
|
+
): void {
|
|
84
|
+
// Only handle JSON language clicks when there's an error
|
|
85
|
+
if (data.language !== "json" || !jsonLspError) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
editor.debug("json-lsp: Status clicked, showing help popup");
|
|
90
|
+
|
|
91
|
+
// Show action popup with install options
|
|
92
|
+
editor.showActionPopup({
|
|
93
|
+
id: "json-lsp-help",
|
|
94
|
+
title: "JSON Language Server Not Found",
|
|
95
|
+
message: `"${jsonLspError.serverCommand}" provides code completion, validation, and formatting for JSON files. Copy the command below to install it.`,
|
|
96
|
+
actions: [
|
|
97
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
98
|
+
{ id: "disable", label: "Disable JSON LSP" },
|
|
99
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Register hook for status bar clicks
|
|
105
|
+
editor.on("lsp_status_clicked", "on_json_lsp_status_clicked");
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Handle action popup results for JSON LSP help
|
|
109
|
+
*/
|
|
110
|
+
globalThis.on_json_lsp_action_result = function (
|
|
111
|
+
data: ActionPopupResultData
|
|
112
|
+
): void {
|
|
113
|
+
// Only handle our popup
|
|
114
|
+
if (data.popup_id !== "json-lsp-help") {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
editor.debug(`json-lsp: Action selected - ${data.action_id}`);
|
|
119
|
+
|
|
120
|
+
switch (data.action_id) {
|
|
121
|
+
case "copy_npm":
|
|
122
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
123
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case "disable":
|
|
127
|
+
editor.disableLspForLanguage("json");
|
|
128
|
+
editor.setStatus("JSON LSP disabled");
|
|
129
|
+
jsonLspError = null;
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case "dismiss":
|
|
133
|
+
case "dismissed":
|
|
134
|
+
// Just close the popup without action
|
|
135
|
+
break;
|
|
136
|
+
|
|
137
|
+
default:
|
|
138
|
+
editor.debug(`json-lsp: Unknown action: ${data.action_id}`);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Register hook for action popup results
|
|
143
|
+
editor.on("action_popup_result", "on_json_lsp_action_result");
|
|
144
|
+
|
|
145
|
+
editor.debug("json-lsp: Plugin loaded");
|