@fresh-editor/fresh-editor 0.1.65 → 0.1.67

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.
@@ -0,0 +1,166 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+
3
+ /**
4
+ * C/C++ LSP Helper Plugin
5
+ *
6
+ * Provides user-friendly error handling for C/C++ LSP server issues.
7
+ * When clangd fails to start, this plugin shows an actionable
8
+ * popup with installation instructions.
9
+ *
10
+ * Features:
11
+ * - Detects C/C++ LSP server errors (clangd)
12
+ * - Shows popup with install commands (apt, brew, etc.)
13
+ * - Allows copying install commands to clipboard
14
+ * - Provides option to disable C/C++ LSP
15
+ */
16
+
17
+ interface LspServerErrorData {
18
+ language: string;
19
+ server_command: string;
20
+ error_type: string;
21
+ message: string;
22
+ }
23
+
24
+ interface LspStatusClickedData {
25
+ language: string;
26
+ has_error: boolean;
27
+ }
28
+
29
+ interface ActionPopupResultData {
30
+ popup_id: string;
31
+ action_id: string;
32
+ }
33
+
34
+ // Install commands for C/C++ LSP server (clangd)
35
+ // See: https://clangd.llvm.org/installation
36
+ const INSTALL_COMMANDS = {
37
+ apt: "sudo apt install clangd",
38
+ brew: "brew install llvm",
39
+ pacman: "sudo pacman -S clang",
40
+ };
41
+
42
+ // Languages handled by this plugin
43
+ const HANDLED_LANGUAGES = ["c", "cpp"];
44
+
45
+ // Track error state for C/C++ LSP
46
+ let clangdLspError: {
47
+ serverCommand: string;
48
+ message: string;
49
+ language: string;
50
+ } | null = null;
51
+
52
+ /**
53
+ * Handle LSP server errors for C/C++
54
+ */
55
+ globalThis.on_clangd_lsp_server_error = function (
56
+ data: LspServerErrorData
57
+ ): void {
58
+ // Only handle C/C++ language errors
59
+ if (!HANDLED_LANGUAGES.includes(data.language)) {
60
+ return;
61
+ }
62
+
63
+ editor.debug(`clangd-lsp: Server error - ${data.error_type}: ${data.message}`);
64
+
65
+ // Store error state for later reference
66
+ clangdLspError = {
67
+ serverCommand: data.server_command,
68
+ message: data.message,
69
+ language: data.language,
70
+ };
71
+
72
+ // Show a status message for immediate feedback
73
+ if (data.error_type === "not_found") {
74
+ editor.setStatus(
75
+ `C/C++ LSP server '${data.server_command}' not found. Click status bar for help.`
76
+ );
77
+ } else {
78
+ editor.setStatus(`C/C++ LSP error: ${data.message}`);
79
+ }
80
+ };
81
+
82
+ // Register hook for LSP server errors
83
+ editor.on("lsp_server_error", "on_clangd_lsp_server_error");
84
+
85
+ /**
86
+ * Handle status bar click when there's a C/C++ LSP error
87
+ */
88
+ globalThis.on_clangd_lsp_status_clicked = function (
89
+ data: LspStatusClickedData
90
+ ): void {
91
+ // Only handle C/C++ language clicks when there's an error
92
+ if (!HANDLED_LANGUAGES.includes(data.language) || !clangdLspError) {
93
+ return;
94
+ }
95
+
96
+ editor.debug("clangd-lsp: Status clicked, showing help popup");
97
+
98
+ // Show action popup with install options
99
+ editor.showActionPopup({
100
+ id: "clangd-lsp-help",
101
+ title: "C/C++ Language Server Not Found",
102
+ message: `"${clangdLspError.serverCommand}" provides code completion, diagnostics, and navigation for C/C++ files. Copy a command below to install it for your platform.`,
103
+ actions: [
104
+ { id: "copy_apt", label: `Copy: ${INSTALL_COMMANDS.apt}` },
105
+ { id: "copy_brew", label: `Copy: ${INSTALL_COMMANDS.brew}` },
106
+ { id: "copy_pacman", label: `Copy: ${INSTALL_COMMANDS.pacman}` },
107
+ { id: "disable", label: "Disable C/C++ LSP" },
108
+ { id: "dismiss", label: "Dismiss (ESC)" },
109
+ ],
110
+ });
111
+ };
112
+
113
+ // Register hook for status bar clicks
114
+ editor.on("lsp_status_clicked", "on_clangd_lsp_status_clicked");
115
+
116
+ /**
117
+ * Handle action popup results for C/C++ LSP help
118
+ */
119
+ globalThis.on_clangd_lsp_action_result = function (
120
+ data: ActionPopupResultData
121
+ ): void {
122
+ // Only handle our popup
123
+ if (data.popup_id !== "clangd-lsp-help") {
124
+ return;
125
+ }
126
+
127
+ editor.debug(`clangd-lsp: Action selected - ${data.action_id}`);
128
+
129
+ switch (data.action_id) {
130
+ case "copy_apt":
131
+ editor.setClipboard(INSTALL_COMMANDS.apt);
132
+ editor.setStatus("Copied: " + INSTALL_COMMANDS.apt);
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_pacman":
141
+ editor.setClipboard(INSTALL_COMMANDS.pacman);
142
+ editor.setStatus("Copied: " + INSTALL_COMMANDS.pacman);
143
+ break;
144
+
145
+ case "disable":
146
+ // Disable for both C and C++
147
+ editor.disableLspForLanguage("c");
148
+ editor.disableLspForLanguage("cpp");
149
+ editor.setStatus("C/C++ LSP disabled");
150
+ clangdLspError = null;
151
+ break;
152
+
153
+ case "dismiss":
154
+ case "dismissed":
155
+ // Just close the popup without action
156
+ break;
157
+
158
+ default:
159
+ editor.debug(`clangd-lsp: Unknown action: ${data.action_id}`);
160
+ }
161
+ };
162
+
163
+ // Register hook for action popup results
164
+ editor.on("action_popup_result", "on_clangd_lsp_action_result");
165
+
166
+ editor.debug("clangd-lsp: Plugin loaded");
@@ -44,7 +44,9 @@
44
44
  "mouse_hover_delay_ms": 500,
45
45
  "double_click_time_ms": 500,
46
46
  "auto_revert_poll_interval_ms": 2000,
47
- "file_tree_poll_interval_ms": 3000
47
+ "file_tree_poll_interval_ms": 3000,
48
+ "default_line_ending": "lf",
49
+ "cursor_style": "default"
48
50
  }
49
51
  },
50
52
  "file_explorer": {
@@ -58,6 +60,13 @@
58
60
  "width": 0.30000001192092896
59
61
  }
60
62
  },
63
+ "file_browser": {
64
+ "description": "File browser settings (Open File dialog)",
65
+ "$ref": "#/$defs/FileBrowserConfig",
66
+ "default": {
67
+ "show_hidden": false
68
+ }
69
+ },
61
70
  "terminal": {
62
71
  "description": "Terminal settings",
63
72
  "$ref": "#/$defs/TerminalConfig",
@@ -252,9 +261,42 @@
252
261
  "format": "uint64",
253
262
  "minimum": 0,
254
263
  "default": 3000
264
+ },
265
+ "default_line_ending": {
266
+ "description": "Default line ending format for new files.\nFiles loaded from disk will use their detected line ending format.\nOptions: \"lf\" (Unix/Linux/macOS), \"crlf\" (Windows), \"cr\" (Classic Mac)\nDefault: \"lf\"",
267
+ "$ref": "#/$defs/LineEndingOption",
268
+ "default": "lf"
269
+ },
270
+ "cursor_style": {
271
+ "description": "Cursor style for the terminal cursor.\nOptions: blinking_block, steady_block, blinking_bar, steady_bar, blinking_underline, steady_underline\nDefault: blinking_block",
272
+ "$ref": "#/$defs/CursorStyle",
273
+ "default": "default"
255
274
  }
256
275
  }
257
276
  },
277
+ "LineEndingOption": {
278
+ "description": "Default line ending format for new files",
279
+ "type": "string",
280
+ "enum": [
281
+ "lf",
282
+ "crlf",
283
+ "cr"
284
+ ],
285
+ "default": "lf"
286
+ },
287
+ "CursorStyle": {
288
+ "description": "Terminal cursor style",
289
+ "type": "string",
290
+ "enum": [
291
+ "default",
292
+ "blinking_block",
293
+ "steady_block",
294
+ "blinking_bar",
295
+ "steady_bar",
296
+ "blinking_underline",
297
+ "steady_underline"
298
+ ]
299
+ },
258
300
  "FileExplorerConfig": {
259
301
  "description": "File explorer configuration",
260
302
  "type": "object",
@@ -290,6 +332,17 @@
290
332
  }
291
333
  }
292
334
  },
335
+ "FileBrowserConfig": {
336
+ "description": "File browser configuration (for Open File dialog)",
337
+ "type": "object",
338
+ "properties": {
339
+ "show_hidden": {
340
+ "description": "Whether to show hidden files (starting with .) by default in Open File dialog",
341
+ "type": "boolean",
342
+ "default": false
343
+ }
344
+ }
345
+ },
293
346
  "TerminalConfig": {
294
347
  "description": "Terminal configuration",
295
348
  "type": "object",
@@ -0,0 +1,145 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+
3
+ /**
4
+ * C# LSP Helper Plugin
5
+ *
6
+ * Provides user-friendly error handling for C# LSP server issues.
7
+ * When csharp-ls fails to start, this plugin shows an actionable
8
+ * popup with installation instructions.
9
+ *
10
+ * Features:
11
+ * - Detects C# LSP server errors (csharp-ls)
12
+ * - Shows popup with install commands (dotnet tool)
13
+ * - Allows copying install commands to clipboard
14
+ * - Provides option to disable C# LSP
15
+ */
16
+
17
+ interface LspServerErrorData {
18
+ language: string;
19
+ server_command: string;
20
+ error_type: string;
21
+ message: string;
22
+ }
23
+
24
+ interface LspStatusClickedData {
25
+ language: string;
26
+ has_error: boolean;
27
+ }
28
+
29
+ interface ActionPopupResultData {
30
+ popup_id: string;
31
+ action_id: string;
32
+ }
33
+
34
+ // Install commands for C# LSP server (csharp-ls)
35
+ // Requires .NET SDK to be installed
36
+ // See: https://github.com/razzmatazz/csharp-language-server
37
+ const INSTALL_COMMANDS = {
38
+ dotnet: "dotnet tool install --global csharp-ls",
39
+ };
40
+
41
+ // Track error state for C# LSP
42
+ let csharpLspError: { serverCommand: string; message: string } | null = null;
43
+
44
+ /**
45
+ * Handle LSP server errors for C#
46
+ */
47
+ globalThis.on_csharp_lsp_server_error = function (
48
+ data: LspServerErrorData
49
+ ): void {
50
+ // Only handle C# language errors
51
+ if (data.language !== "csharp") {
52
+ return;
53
+ }
54
+
55
+ editor.debug(
56
+ `csharp-lsp: Server error - ${data.error_type}: ${data.message}`
57
+ );
58
+
59
+ // Store error state for later reference
60
+ csharpLspError = {
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
+ `C# LSP server '${data.server_command}' not found. Click status bar for help.`
69
+ );
70
+ } else {
71
+ editor.setStatus(`C# LSP error: ${data.message}`);
72
+ }
73
+ };
74
+
75
+ // Register hook for LSP server errors
76
+ editor.on("lsp_server_error", "on_csharp_lsp_server_error");
77
+
78
+ /**
79
+ * Handle status bar click when there's a C# LSP error
80
+ */
81
+ globalThis.on_csharp_lsp_status_clicked = function (
82
+ data: LspStatusClickedData
83
+ ): void {
84
+ // Only handle C# language clicks when there's an error
85
+ if (data.language !== "csharp" || !csharpLspError) {
86
+ return;
87
+ }
88
+
89
+ editor.debug("csharp-lsp: Status clicked, showing help popup");
90
+
91
+ // Show action popup with install options
92
+ editor.showActionPopup({
93
+ id: "csharp-lsp-help",
94
+ title: "C# Language Server Not Found",
95
+ message: `"${csharpLspError.serverCommand}" provides code completion, diagnostics, and navigation for C# files. Requires .NET SDK. Copy the command below to install it.`,
96
+ actions: [
97
+ { id: "copy_dotnet", label: `Copy: ${INSTALL_COMMANDS.dotnet}` },
98
+ { id: "disable", label: "Disable C# 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_csharp_lsp_status_clicked");
106
+
107
+ /**
108
+ * Handle action popup results for C# LSP help
109
+ */
110
+ globalThis.on_csharp_lsp_action_result = function (
111
+ data: ActionPopupResultData
112
+ ): void {
113
+ // Only handle our popup
114
+ if (data.popup_id !== "csharp-lsp-help") {
115
+ return;
116
+ }
117
+
118
+ editor.debug(`csharp-lsp: Action selected - ${data.action_id}`);
119
+
120
+ switch (data.action_id) {
121
+ case "copy_dotnet":
122
+ editor.setClipboard(INSTALL_COMMANDS.dotnet);
123
+ editor.setStatus("Copied: " + INSTALL_COMMANDS.dotnet);
124
+ break;
125
+
126
+ case "disable":
127
+ editor.disableLspForLanguage("csharp");
128
+ editor.setStatus("C# LSP disabled");
129
+ csharpLspError = 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(`csharp-lsp: Unknown action: ${data.action_id}`);
139
+ }
140
+ };
141
+
142
+ // Register hook for action popup results
143
+ editor.on("action_popup_result", "on_csharp_lsp_action_result");
144
+
145
+ editor.debug("csharp-lsp: Plugin loaded");
@@ -0,0 +1,141 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+
3
+ /**
4
+ * CSS LSP Helper Plugin
5
+ *
6
+ * Provides user-friendly error handling for CSS LSP server issues.
7
+ * When the CSS language server fails to start, this plugin shows an
8
+ * actionable popup with installation instructions.
9
+ *
10
+ * Features:
11
+ * - Detects CSS LSP server errors
12
+ * - Shows popup with install commands (npm)
13
+ * - Allows copying install commands to clipboard
14
+ * - Provides option to disable CSS LSP
15
+ */
16
+
17
+ interface LspServerErrorData {
18
+ language: string;
19
+ server_command: string;
20
+ error_type: string;
21
+ message: string;
22
+ }
23
+
24
+ interface LspStatusClickedData {
25
+ language: string;
26
+ has_error: boolean;
27
+ }
28
+
29
+ interface ActionPopupResultData {
30
+ popup_id: string;
31
+ action_id: string;
32
+ }
33
+
34
+ // Install commands for CSS LSP server
35
+ // vscode-langservers-extracted provides HTML, CSS, and JSON language servers
36
+ // See: https://www.npmjs.com/package/vscode-langservers-extracted
37
+ const INSTALL_COMMANDS = {
38
+ npm: "npm install -g vscode-langservers-extracted",
39
+ };
40
+
41
+ // Track error state for CSS LSP
42
+ let cssLspError: { serverCommand: string; message: string } | null = null;
43
+
44
+ /**
45
+ * Handle LSP server errors for CSS
46
+ */
47
+ globalThis.on_css_lsp_server_error = function (data: LspServerErrorData): void {
48
+ // Only handle CSS language errors
49
+ if (data.language !== "css") {
50
+ return;
51
+ }
52
+
53
+ editor.debug(`css-lsp: Server error - ${data.error_type}: ${data.message}`);
54
+
55
+ // Store error state for later reference
56
+ cssLspError = {
57
+ serverCommand: data.server_command,
58
+ message: data.message,
59
+ };
60
+
61
+ // Show a status message for immediate feedback
62
+ if (data.error_type === "not_found") {
63
+ editor.setStatus(
64
+ `CSS LSP server '${data.server_command}' not found. Click status bar for help.`
65
+ );
66
+ } else {
67
+ editor.setStatus(`CSS LSP error: ${data.message}`);
68
+ }
69
+ };
70
+
71
+ // Register hook for LSP server errors
72
+ editor.on("lsp_server_error", "on_css_lsp_server_error");
73
+
74
+ /**
75
+ * Handle status bar click when there's a CSS LSP error
76
+ */
77
+ globalThis.on_css_lsp_status_clicked = function (
78
+ data: LspStatusClickedData
79
+ ): void {
80
+ // Only handle CSS language clicks when there's an error
81
+ if (data.language !== "css" || !cssLspError) {
82
+ return;
83
+ }
84
+
85
+ editor.debug("css-lsp: Status clicked, showing help popup");
86
+
87
+ // Show action popup with install options
88
+ editor.showActionPopup({
89
+ id: "css-lsp-help",
90
+ title: "CSS Language Server Not Found",
91
+ message: `"${cssLspError.serverCommand}" provides code completion, diagnostics, and formatting for CSS files. Copy the command below to install it.`,
92
+ actions: [
93
+ { id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
94
+ { id: "disable", label: "Disable CSS LSP" },
95
+ { id: "dismiss", label: "Dismiss (ESC)" },
96
+ ],
97
+ });
98
+ };
99
+
100
+ // Register hook for status bar clicks
101
+ editor.on("lsp_status_clicked", "on_css_lsp_status_clicked");
102
+
103
+ /**
104
+ * Handle action popup results for CSS LSP help
105
+ */
106
+ globalThis.on_css_lsp_action_result = function (
107
+ data: ActionPopupResultData
108
+ ): void {
109
+ // Only handle our popup
110
+ if (data.popup_id !== "css-lsp-help") {
111
+ return;
112
+ }
113
+
114
+ editor.debug(`css-lsp: Action selected - ${data.action_id}`);
115
+
116
+ switch (data.action_id) {
117
+ case "copy_npm":
118
+ editor.setClipboard(INSTALL_COMMANDS.npm);
119
+ editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
120
+ break;
121
+
122
+ case "disable":
123
+ editor.disableLspForLanguage("css");
124
+ editor.setStatus("CSS LSP disabled");
125
+ cssLspError = null;
126
+ break;
127
+
128
+ case "dismiss":
129
+ case "dismissed":
130
+ // Just close the popup without action
131
+ break;
132
+
133
+ default:
134
+ editor.debug(`css-lsp: Unknown action: ${data.action_id}`);
135
+ }
136
+ };
137
+
138
+ // Register hook for action popup results
139
+ editor.on("action_popup_result", "on_css_lsp_action_result");
140
+
141
+ editor.debug("css-lsp: Plugin loaded");
@@ -0,0 +1,141 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+
3
+ /**
4
+ * Go LSP Helper Plugin
5
+ *
6
+ * Provides user-friendly error handling for Go LSP server issues.
7
+ * When gopls fails to start, this plugin shows an actionable
8
+ * popup with installation instructions.
9
+ *
10
+ * Features:
11
+ * - Detects Go LSP server errors (gopls)
12
+ * - Shows popup with install commands
13
+ * - Allows copying install commands to clipboard
14
+ * - Provides option to disable Go LSP
15
+ */
16
+
17
+ interface LspServerErrorData {
18
+ language: string;
19
+ server_command: string;
20
+ error_type: string;
21
+ message: string;
22
+ }
23
+
24
+ interface LspStatusClickedData {
25
+ language: string;
26
+ has_error: boolean;
27
+ }
28
+
29
+ interface ActionPopupResultData {
30
+ popup_id: string;
31
+ action_id: string;
32
+ }
33
+
34
+ // Install commands for Go LSP server (gopls)
35
+ // go install is the official recommended method
36
+ // See: https://pkg.go.dev/golang.org/x/tools/gopls
37
+ const INSTALL_COMMANDS = {
38
+ go: "go install golang.org/x/tools/gopls@latest",
39
+ };
40
+
41
+ // Track error state for Go LSP
42
+ let goLspError: { serverCommand: string; message: string } | null = null;
43
+
44
+ /**
45
+ * Handle LSP server errors for Go
46
+ */
47
+ globalThis.on_go_lsp_server_error = function (data: LspServerErrorData): void {
48
+ // Only handle Go language errors
49
+ if (data.language !== "go") {
50
+ return;
51
+ }
52
+
53
+ editor.debug(`go-lsp: Server error - ${data.error_type}: ${data.message}`);
54
+
55
+ // Store error state for later reference
56
+ goLspError = {
57
+ serverCommand: data.server_command,
58
+ message: data.message,
59
+ };
60
+
61
+ // Show a status message for immediate feedback
62
+ if (data.error_type === "not_found") {
63
+ editor.setStatus(
64
+ `Go LSP server '${data.server_command}' not found. Click status bar for help.`
65
+ );
66
+ } else {
67
+ editor.setStatus(`Go LSP error: ${data.message}`);
68
+ }
69
+ };
70
+
71
+ // Register hook for LSP server errors
72
+ editor.on("lsp_server_error", "on_go_lsp_server_error");
73
+
74
+ /**
75
+ * Handle status bar click when there's a Go LSP error
76
+ */
77
+ globalThis.on_go_lsp_status_clicked = function (
78
+ data: LspStatusClickedData
79
+ ): void {
80
+ // Only handle Go language clicks when there's an error
81
+ if (data.language !== "go" || !goLspError) {
82
+ return;
83
+ }
84
+
85
+ editor.debug("go-lsp: Status clicked, showing help popup");
86
+
87
+ // Show action popup with install options
88
+ editor.showActionPopup({
89
+ id: "go-lsp-help",
90
+ title: "Go Language Server Not Found",
91
+ message: `"${goLspError.serverCommand}" provides code completion, diagnostics, and navigation for Go files. Copy the command below to install it.`,
92
+ actions: [
93
+ { id: "copy_go", label: `Copy: ${INSTALL_COMMANDS.go}` },
94
+ { id: "disable", label: "Disable Go LSP" },
95
+ { id: "dismiss", label: "Dismiss (ESC)" },
96
+ ],
97
+ });
98
+ };
99
+
100
+ // Register hook for status bar clicks
101
+ editor.on("lsp_status_clicked", "on_go_lsp_status_clicked");
102
+
103
+ /**
104
+ * Handle action popup results for Go LSP help
105
+ */
106
+ globalThis.on_go_lsp_action_result = function (
107
+ data: ActionPopupResultData
108
+ ): void {
109
+ // Only handle our popup
110
+ if (data.popup_id !== "go-lsp-help") {
111
+ return;
112
+ }
113
+
114
+ editor.debug(`go-lsp: Action selected - ${data.action_id}`);
115
+
116
+ switch (data.action_id) {
117
+ case "copy_go":
118
+ editor.setClipboard(INSTALL_COMMANDS.go);
119
+ editor.setStatus("Copied: " + INSTALL_COMMANDS.go);
120
+ break;
121
+
122
+ case "disable":
123
+ editor.disableLspForLanguage("go");
124
+ editor.setStatus("Go LSP disabled");
125
+ goLspError = null;
126
+ break;
127
+
128
+ case "dismiss":
129
+ case "dismissed":
130
+ // Just close the popup without action
131
+ break;
132
+
133
+ default:
134
+ editor.debug(`go-lsp: Unknown action: ${data.action_id}`);
135
+ }
136
+ };
137
+
138
+ // Register hook for action popup results
139
+ editor.on("action_popup_result", "on_go_lsp_action_result");
140
+
141
+ editor.debug("go-lsp: Plugin loaded");