@fresh-editor/fresh-editor 0.1.65 → 0.1.69
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 +106 -0
- package/README.md +4 -2
- package/package.json +1 -1
- package/plugins/audit_mode.i18n.json +380 -0
- package/plugins/audit_mode.ts +1813 -0
- package/plugins/buffer_modified.i18n.json +32 -0
- package/plugins/buffer_modified.ts +5 -3
- package/plugins/calculator.i18n.json +44 -0
- package/plugins/calculator.ts +6 -4
- package/plugins/clangd-lsp.ts +168 -0
- package/plugins/clangd_support.i18n.json +104 -0
- package/plugins/clangd_support.ts +18 -16
- package/plugins/color_highlighter.i18n.json +68 -0
- package/plugins/color_highlighter.ts +12 -10
- package/plugins/config-schema.json +79 -141
- package/plugins/csharp-lsp.ts +147 -0
- package/plugins/csharp_support.i18n.json +38 -0
- package/plugins/csharp_support.ts +6 -4
- package/plugins/css-lsp.ts +143 -0
- package/plugins/diagnostics_panel.i18n.json +110 -0
- package/plugins/diagnostics_panel.ts +19 -17
- package/plugins/find_references.i18n.json +128 -0
- package/plugins/find_references.ts +22 -20
- package/plugins/git_blame.i18n.json +230 -0
- package/plugins/git_blame.ts +39 -37
- package/plugins/git_find_file.i18n.json +146 -0
- package/plugins/git_find_file.ts +24 -22
- package/plugins/git_grep.i18n.json +80 -0
- package/plugins/git_grep.ts +15 -13
- package/plugins/git_gutter.i18n.json +44 -0
- package/plugins/git_gutter.ts +7 -5
- package/plugins/git_log.i18n.json +224 -0
- package/plugins/git_log.ts +41 -39
- package/plugins/go-lsp.ts +143 -0
- package/plugins/html-lsp.ts +145 -0
- package/plugins/json-lsp.ts +145 -0
- package/plugins/lib/fresh.d.ts +150 -14
- package/plugins/lib/index.ts +1 -1
- package/plugins/lib/navigation-controller.ts +3 -3
- package/plugins/lib/panel-manager.ts +15 -13
- package/plugins/lib/virtual-buffer-factory.ts +84 -112
- package/plugins/live_grep.i18n.json +80 -0
- package/plugins/live_grep.ts +15 -13
- package/plugins/markdown_compose.i18n.json +104 -0
- package/plugins/markdown_compose.ts +17 -15
- package/plugins/merge_conflict.i18n.json +380 -0
- package/plugins/merge_conflict.ts +72 -73
- package/plugins/path_complete.i18n.json +38 -0
- package/plugins/path_complete.ts +6 -4
- package/plugins/python-lsp.ts +162 -0
- package/plugins/rust-lsp.ts +166 -0
- package/plugins/search_replace.i18n.json +188 -0
- package/plugins/search_replace.ts +31 -29
- package/plugins/test_i18n.i18n.json +12 -0
- package/plugins/test_i18n.ts +18 -0
- package/plugins/theme_editor.i18n.json +1417 -0
- package/plugins/theme_editor.ts +73 -69
- package/plugins/todo_highlighter.i18n.json +86 -0
- package/plugins/todo_highlighter.ts +15 -13
- package/plugins/typescript-lsp.ts +167 -0
- package/plugins/vi_mode.i18n.json +716 -0
- package/plugins/vi_mode.ts +2747 -0
- package/plugins/welcome.i18n.json +110 -0
- package/plugins/welcome.ts +18 -16
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"$ref": "#/$defs/ThemeOptions",
|
|
17
17
|
"default": "high-contrast"
|
|
18
18
|
},
|
|
19
|
+
"locale": {
|
|
20
|
+
"description": "UI locale (language) for translations\nIf not set, auto-detected from environment (LC_ALL, LC_MESSAGES, LANG)",
|
|
21
|
+
"$ref": "#/$defs/LocaleOptions",
|
|
22
|
+
"default": null
|
|
23
|
+
},
|
|
19
24
|
"check_for_updates": {
|
|
20
25
|
"description": "Check for new versions on quit (default: true)",
|
|
21
26
|
"type": "boolean",
|
|
@@ -44,7 +49,9 @@
|
|
|
44
49
|
"mouse_hover_delay_ms": 500,
|
|
45
50
|
"double_click_time_ms": 500,
|
|
46
51
|
"auto_revert_poll_interval_ms": 2000,
|
|
47
|
-
"file_tree_poll_interval_ms": 3000
|
|
52
|
+
"file_tree_poll_interval_ms": 3000,
|
|
53
|
+
"default_line_ending": "lf",
|
|
54
|
+
"cursor_style": "default"
|
|
48
55
|
}
|
|
49
56
|
},
|
|
50
57
|
"file_explorer": {
|
|
@@ -58,6 +65,13 @@
|
|
|
58
65
|
"width": 0.30000001192092896
|
|
59
66
|
}
|
|
60
67
|
},
|
|
68
|
+
"file_browser": {
|
|
69
|
+
"description": "File browser settings (Open File dialog)",
|
|
70
|
+
"$ref": "#/$defs/FileBrowserConfig",
|
|
71
|
+
"default": {
|
|
72
|
+
"show_hidden": false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
61
75
|
"terminal": {
|
|
62
76
|
"description": "Terminal settings",
|
|
63
77
|
"$ref": "#/$defs/TerminalConfig",
|
|
@@ -102,10 +116,6 @@
|
|
|
102
116
|
},
|
|
103
117
|
"default": {}
|
|
104
118
|
},
|
|
105
|
-
"menu": {
|
|
106
|
-
"description": "Menu bar configuration",
|
|
107
|
-
"$ref": "#/$defs/MenuConfig"
|
|
108
|
-
},
|
|
109
119
|
"warnings": {
|
|
110
120
|
"description": "Warning notification settings",
|
|
111
121
|
"$ref": "#/$defs/WarningsConfig",
|
|
@@ -125,6 +135,24 @@
|
|
|
125
135
|
"nostalgia"
|
|
126
136
|
]
|
|
127
137
|
},
|
|
138
|
+
"LocaleOptions": {
|
|
139
|
+
"description": "UI locale (language). Use null for auto-detection from environment.",
|
|
140
|
+
"enum": [
|
|
141
|
+
null,
|
|
142
|
+
"cs",
|
|
143
|
+
"de",
|
|
144
|
+
"en",
|
|
145
|
+
"es",
|
|
146
|
+
"fr",
|
|
147
|
+
"ja",
|
|
148
|
+
"ko",
|
|
149
|
+
"pt-BR",
|
|
150
|
+
"ru",
|
|
151
|
+
"th",
|
|
152
|
+
"uk",
|
|
153
|
+
"zh-CN"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
128
156
|
"EditorConfig": {
|
|
129
157
|
"description": "Editor behavior configuration",
|
|
130
158
|
"type": "object",
|
|
@@ -252,9 +280,42 @@
|
|
|
252
280
|
"format": "uint64",
|
|
253
281
|
"minimum": 0,
|
|
254
282
|
"default": 3000
|
|
283
|
+
},
|
|
284
|
+
"default_line_ending": {
|
|
285
|
+
"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\"",
|
|
286
|
+
"$ref": "#/$defs/LineEndingOption",
|
|
287
|
+
"default": "lf"
|
|
288
|
+
},
|
|
289
|
+
"cursor_style": {
|
|
290
|
+
"description": "Cursor style for the terminal cursor.\nOptions: blinking_block, steady_block, blinking_bar, steady_bar, blinking_underline, steady_underline\nDefault: blinking_block",
|
|
291
|
+
"$ref": "#/$defs/CursorStyle",
|
|
292
|
+
"default": "default"
|
|
255
293
|
}
|
|
256
294
|
}
|
|
257
295
|
},
|
|
296
|
+
"LineEndingOption": {
|
|
297
|
+
"description": "Default line ending format for new files",
|
|
298
|
+
"type": "string",
|
|
299
|
+
"enum": [
|
|
300
|
+
"lf",
|
|
301
|
+
"crlf",
|
|
302
|
+
"cr"
|
|
303
|
+
],
|
|
304
|
+
"default": "lf"
|
|
305
|
+
},
|
|
306
|
+
"CursorStyle": {
|
|
307
|
+
"description": "Terminal cursor style",
|
|
308
|
+
"type": "string",
|
|
309
|
+
"enum": [
|
|
310
|
+
"default",
|
|
311
|
+
"blinking_block",
|
|
312
|
+
"steady_block",
|
|
313
|
+
"blinking_bar",
|
|
314
|
+
"steady_bar",
|
|
315
|
+
"blinking_underline",
|
|
316
|
+
"steady_underline"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
258
319
|
"FileExplorerConfig": {
|
|
259
320
|
"description": "File explorer configuration",
|
|
260
321
|
"type": "object",
|
|
@@ -290,6 +351,17 @@
|
|
|
290
351
|
}
|
|
291
352
|
}
|
|
292
353
|
},
|
|
354
|
+
"FileBrowserConfig": {
|
|
355
|
+
"description": "File browser configuration (for Open File dialog)",
|
|
356
|
+
"type": "object",
|
|
357
|
+
"properties": {
|
|
358
|
+
"show_hidden": {
|
|
359
|
+
"description": "Whether to show hidden files (starting with .) by default in Open File dialog",
|
|
360
|
+
"type": "boolean",
|
|
361
|
+
"default": false
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
},
|
|
293
365
|
"TerminalConfig": {
|
|
294
366
|
"description": "Terminal configuration",
|
|
295
367
|
"type": "object",
|
|
@@ -396,7 +468,8 @@
|
|
|
396
468
|
"enum": [
|
|
397
469
|
"default",
|
|
398
470
|
"emacs",
|
|
399
|
-
"vscode"
|
|
471
|
+
"vscode",
|
|
472
|
+
"macos"
|
|
400
473
|
]
|
|
401
474
|
},
|
|
402
475
|
"LanguageConfig": {
|
|
@@ -675,141 +748,6 @@
|
|
|
675
748
|
}
|
|
676
749
|
}
|
|
677
750
|
},
|
|
678
|
-
"MenuConfig": {
|
|
679
|
-
"description": "Menu bar configuration",
|
|
680
|
-
"type": "object",
|
|
681
|
-
"properties": {
|
|
682
|
-
"menus": {
|
|
683
|
-
"description": "List of top-level menus in the menu bar",
|
|
684
|
-
"type": "array",
|
|
685
|
-
"items": {
|
|
686
|
-
"$ref": "#/$defs/Menu"
|
|
687
|
-
},
|
|
688
|
-
"default": []
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
},
|
|
692
|
-
"Menu": {
|
|
693
|
-
"description": "A top-level menu in the menu bar",
|
|
694
|
-
"type": "object",
|
|
695
|
-
"properties": {
|
|
696
|
-
"label": {
|
|
697
|
-
"description": "Display label for the menu (e.g., \"File\", \"Edit\")",
|
|
698
|
-
"type": "string"
|
|
699
|
-
},
|
|
700
|
-
"items": {
|
|
701
|
-
"description": "Menu items (actions, separators, or submenus)",
|
|
702
|
-
"type": "array",
|
|
703
|
-
"items": {
|
|
704
|
-
"$ref": "#/$defs/MenuItem"
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
},
|
|
708
|
-
"required": [
|
|
709
|
-
"label",
|
|
710
|
-
"items"
|
|
711
|
-
]
|
|
712
|
-
},
|
|
713
|
-
"MenuItem": {
|
|
714
|
-
"description": "A menu item (action, separator, or submenu)",
|
|
715
|
-
"anyOf": [
|
|
716
|
-
{
|
|
717
|
-
"description": "A separator line",
|
|
718
|
-
"type": "object",
|
|
719
|
-
"properties": {
|
|
720
|
-
"separator": {
|
|
721
|
-
"type": "boolean"
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
"required": [
|
|
725
|
-
"separator"
|
|
726
|
-
]
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
"description": "An action item",
|
|
730
|
-
"type": "object",
|
|
731
|
-
"properties": {
|
|
732
|
-
"label": {
|
|
733
|
-
"type": "string"
|
|
734
|
-
},
|
|
735
|
-
"action": {
|
|
736
|
-
"type": "string"
|
|
737
|
-
},
|
|
738
|
-
"args": {
|
|
739
|
-
"type": "object",
|
|
740
|
-
"additionalProperties": true,
|
|
741
|
-
"default": {}
|
|
742
|
-
},
|
|
743
|
-
"when": {
|
|
744
|
-
"type": [
|
|
745
|
-
"string",
|
|
746
|
-
"null"
|
|
747
|
-
],
|
|
748
|
-
"default": null
|
|
749
|
-
},
|
|
750
|
-
"checkbox": {
|
|
751
|
-
"description": "Checkbox state condition (e.g., \"line_numbers\", \"line_wrap\")",
|
|
752
|
-
"type": [
|
|
753
|
-
"string",
|
|
754
|
-
"null"
|
|
755
|
-
],
|
|
756
|
-
"default": null
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
"required": [
|
|
760
|
-
"label",
|
|
761
|
-
"action"
|
|
762
|
-
]
|
|
763
|
-
},
|
|
764
|
-
{
|
|
765
|
-
"description": "A submenu (for future extensibility)",
|
|
766
|
-
"type": "object",
|
|
767
|
-
"properties": {
|
|
768
|
-
"label": {
|
|
769
|
-
"type": "string"
|
|
770
|
-
},
|
|
771
|
-
"items": {
|
|
772
|
-
"type": "array",
|
|
773
|
-
"items": {
|
|
774
|
-
"$ref": "#/$defs/MenuItem"
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
},
|
|
778
|
-
"required": [
|
|
779
|
-
"label",
|
|
780
|
-
"items"
|
|
781
|
-
]
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
"description": "A dynamic submenu whose items are generated at runtime\nThe `source` field specifies what to generate (e.g., \"themes\")",
|
|
785
|
-
"type": "object",
|
|
786
|
-
"properties": {
|
|
787
|
-
"label": {
|
|
788
|
-
"type": "string"
|
|
789
|
-
},
|
|
790
|
-
"source": {
|
|
791
|
-
"type": "string"
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
"required": [
|
|
795
|
-
"label",
|
|
796
|
-
"source"
|
|
797
|
-
]
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
"description": "A disabled info label (no action)",
|
|
801
|
-
"type": "object",
|
|
802
|
-
"properties": {
|
|
803
|
-
"info": {
|
|
804
|
-
"type": "string"
|
|
805
|
-
}
|
|
806
|
-
},
|
|
807
|
-
"required": [
|
|
808
|
-
"info"
|
|
809
|
-
]
|
|
810
|
-
}
|
|
811
|
-
]
|
|
812
|
-
},
|
|
813
751
|
"WarningsConfig": {
|
|
814
752
|
"description": "Warning notification configuration",
|
|
815
753
|
"type": "object",
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* C# LSP Helper Plugin
|
|
7
|
+
*
|
|
8
|
+
* Provides user-friendly error handling for C# LSP server issues.
|
|
9
|
+
* When csharp-ls fails to start, this plugin shows an actionable
|
|
10
|
+
* popup with installation instructions.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Detects C# LSP server errors (csharp-ls)
|
|
14
|
+
* - Shows popup with install commands (dotnet tool)
|
|
15
|
+
* - Allows copying install commands to clipboard
|
|
16
|
+
* - Provides option to disable C# 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 C# LSP server (csharp-ls)
|
|
37
|
+
// Requires .NET SDK to be installed
|
|
38
|
+
// See: https://github.com/razzmatazz/csharp-language-server
|
|
39
|
+
const INSTALL_COMMANDS = {
|
|
40
|
+
dotnet: "dotnet tool install --global csharp-ls",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Track error state for C# LSP
|
|
44
|
+
let csharpLspError: { serverCommand: string; message: string } | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handle LSP server errors for C#
|
|
48
|
+
*/
|
|
49
|
+
globalThis.on_csharp_lsp_server_error = function (
|
|
50
|
+
data: LspServerErrorData
|
|
51
|
+
): void {
|
|
52
|
+
// Only handle C# language errors
|
|
53
|
+
if (data.language !== "csharp") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
editor.debug(
|
|
58
|
+
`csharp-lsp: Server error - ${data.error_type}: ${data.message}`
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Store error state for later reference
|
|
62
|
+
csharpLspError = {
|
|
63
|
+
serverCommand: data.server_command,
|
|
64
|
+
message: data.message,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Show a status message for immediate feedback
|
|
68
|
+
if (data.error_type === "not_found") {
|
|
69
|
+
editor.setStatus(
|
|
70
|
+
`C# LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
71
|
+
);
|
|
72
|
+
} else {
|
|
73
|
+
editor.setStatus(`C# LSP error: ${data.message}`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Register hook for LSP server errors
|
|
78
|
+
editor.on("lsp_server_error", "on_csharp_lsp_server_error");
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Handle status bar click when there's a C# LSP error
|
|
82
|
+
*/
|
|
83
|
+
globalThis.on_csharp_lsp_status_clicked = function (
|
|
84
|
+
data: LspStatusClickedData
|
|
85
|
+
): void {
|
|
86
|
+
// Only handle C# language clicks when there's an error
|
|
87
|
+
if (data.language !== "csharp" || !csharpLspError) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
editor.debug("csharp-lsp: Status clicked, showing help popup");
|
|
92
|
+
|
|
93
|
+
// Show action popup with install options
|
|
94
|
+
editor.showActionPopup({
|
|
95
|
+
id: "csharp-lsp-help",
|
|
96
|
+
title: "C# Language Server Not Found",
|
|
97
|
+
message: `"${csharpLspError.serverCommand}" provides code completion, diagnostics, and navigation for C# files. Requires .NET SDK. Copy the command below to install it.`,
|
|
98
|
+
actions: [
|
|
99
|
+
{ id: "copy_dotnet", label: `Copy: ${INSTALL_COMMANDS.dotnet}` },
|
|
100
|
+
{ id: "disable", label: "Disable C# LSP" },
|
|
101
|
+
{ id: "dismiss", label: "Dismiss (ESC)" },
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Register hook for status bar clicks
|
|
107
|
+
editor.on("lsp_status_clicked", "on_csharp_lsp_status_clicked");
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Handle action popup results for C# LSP help
|
|
111
|
+
*/
|
|
112
|
+
globalThis.on_csharp_lsp_action_result = function (
|
|
113
|
+
data: ActionPopupResultData
|
|
114
|
+
): void {
|
|
115
|
+
// Only handle our popup
|
|
116
|
+
if (data.popup_id !== "csharp-lsp-help") {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
editor.debug(`csharp-lsp: Action selected - ${data.action_id}`);
|
|
121
|
+
|
|
122
|
+
switch (data.action_id) {
|
|
123
|
+
case "copy_dotnet":
|
|
124
|
+
editor.setClipboard(INSTALL_COMMANDS.dotnet);
|
|
125
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.dotnet);
|
|
126
|
+
break;
|
|
127
|
+
|
|
128
|
+
case "disable":
|
|
129
|
+
editor.disableLspForLanguage("csharp");
|
|
130
|
+
editor.setStatus("C# LSP disabled");
|
|
131
|
+
csharpLspError = null;
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
case "dismiss":
|
|
135
|
+
case "dismissed":
|
|
136
|
+
// Just close the popup without action
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
editor.debug(`csharp-lsp: Unknown action: ${data.action_id}`);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Register hook for action popup results
|
|
145
|
+
editor.on("action_popup_result", "on_csharp_lsp_action_result");
|
|
146
|
+
|
|
147
|
+
editor.debug("csharp-lsp: Plugin loaded");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"status.restoring_packages": "Restoring NuGet packages for {project}...",
|
|
4
|
+
"status.restore_completed": "NuGet restore completed for {project}",
|
|
5
|
+
"status.restore_failed": "NuGet restore failed: {error}",
|
|
6
|
+
"status.restore_error": "NuGet restore error: {error}"
|
|
7
|
+
},
|
|
8
|
+
"es": {
|
|
9
|
+
"status.restoring_packages": "Restaurando paquetes NuGet para {project}...",
|
|
10
|
+
"status.restore_completed": "Restauracion de NuGet completada para {project}",
|
|
11
|
+
"status.restore_failed": "Restauracion de NuGet fallida: {error}",
|
|
12
|
+
"status.restore_error": "Error de restauracion de NuGet: {error}"
|
|
13
|
+
},
|
|
14
|
+
"de": {
|
|
15
|
+
"status.restoring_packages": "NuGet-Pakete werden fur {project} wiederhergestellt...",
|
|
16
|
+
"status.restore_completed": "NuGet-Wiederherstellung fur {project} abgeschlossen",
|
|
17
|
+
"status.restore_failed": "NuGet-Wiederherstellung fehlgeschlagen: {error}",
|
|
18
|
+
"status.restore_error": "NuGet-Wiederherstellungsfehler: {error}"
|
|
19
|
+
},
|
|
20
|
+
"fr": {
|
|
21
|
+
"status.restoring_packages": "Restauration des paquets NuGet pour {project}...",
|
|
22
|
+
"status.restore_completed": "Restauration NuGet terminee pour {project}",
|
|
23
|
+
"status.restore_failed": "Echec de la restauration NuGet: {error}",
|
|
24
|
+
"status.restore_error": "Erreur de restauration NuGet: {error}"
|
|
25
|
+
},
|
|
26
|
+
"ja": {
|
|
27
|
+
"status.restoring_packages": "{project}のNuGetパッケージを復元中...",
|
|
28
|
+
"status.restore_completed": "{project}のNuGet復元が完了しました",
|
|
29
|
+
"status.restore_failed": "NuGet復元に失敗しました: {error}",
|
|
30
|
+
"status.restore_error": "NuGet復元エラー: {error}"
|
|
31
|
+
},
|
|
32
|
+
"zh": {
|
|
33
|
+
"status.restoring_packages": "正在为{project}恢复NuGet包...",
|
|
34
|
+
"status.restore_completed": "{project}的NuGet恢复已完成",
|
|
35
|
+
"status.restore_failed": "NuGet恢复失败: {error}",
|
|
36
|
+
"status.restore_error": "NuGet恢复错误: {error}"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* C# Language Server Support Plugin
|
|
@@ -65,22 +67,22 @@ async function restoreProject(projectPath: string): Promise<void> {
|
|
|
65
67
|
return;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
editor.setStatus(
|
|
70
|
+
editor.setStatus(editor.t("status.restoring_packages", { project: projectPath }));
|
|
69
71
|
editor.debug(`csharp_support: Running dotnet restore for ${projectPath}`);
|
|
70
72
|
|
|
71
73
|
try {
|
|
72
74
|
const result = await editor.spawnProcess("dotnet", ["restore", projectPath]);
|
|
73
75
|
|
|
74
76
|
if (result.exit_code === 0) {
|
|
75
|
-
editor.setStatus(
|
|
77
|
+
editor.setStatus(editor.t("status.restore_completed", { project: projectPath }));
|
|
76
78
|
editor.debug(`csharp_support: dotnet restore succeeded`);
|
|
77
79
|
} else {
|
|
78
|
-
editor.setStatus(
|
|
80
|
+
editor.setStatus(editor.t("status.restore_failed", { error: result.stderr }));
|
|
79
81
|
editor.debug(`csharp_support: dotnet restore failed: ${result.stderr}`);
|
|
80
82
|
}
|
|
81
83
|
} catch (e) {
|
|
82
84
|
const err = e instanceof Error ? e : new Error(String(e));
|
|
83
|
-
editor.setStatus(
|
|
85
|
+
editor.setStatus(editor.t("status.restore_error", { error: err.message }));
|
|
84
86
|
editor.debug(`csharp_support: dotnet restore error: ${err.message}`);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CSS LSP Helper Plugin
|
|
7
|
+
*
|
|
8
|
+
* Provides user-friendly error handling for CSS LSP server issues.
|
|
9
|
+
* When the CSS language server fails to start, this plugin shows an
|
|
10
|
+
* actionable popup with installation instructions.
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Detects CSS LSP server errors
|
|
14
|
+
* - Shows popup with install commands (npm)
|
|
15
|
+
* - Allows copying install commands to clipboard
|
|
16
|
+
* - Provides option to disable CSS 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 CSS 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 CSS LSP
|
|
44
|
+
let cssLspError: { serverCommand: string; message: string } | null = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handle LSP server errors for CSS
|
|
48
|
+
*/
|
|
49
|
+
globalThis.on_css_lsp_server_error = function (data: LspServerErrorData): void {
|
|
50
|
+
// Only handle CSS language errors
|
|
51
|
+
if (data.language !== "css") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
editor.debug(`css-lsp: Server error - ${data.error_type}: ${data.message}`);
|
|
56
|
+
|
|
57
|
+
// Store error state for later reference
|
|
58
|
+
cssLspError = {
|
|
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
|
+
`CSS LSP server '${data.server_command}' not found. Click status bar for help.`
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
editor.setStatus(`CSS LSP error: ${data.message}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Register hook for LSP server errors
|
|
74
|
+
editor.on("lsp_server_error", "on_css_lsp_server_error");
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Handle status bar click when there's a CSS LSP error
|
|
78
|
+
*/
|
|
79
|
+
globalThis.on_css_lsp_status_clicked = function (
|
|
80
|
+
data: LspStatusClickedData
|
|
81
|
+
): void {
|
|
82
|
+
// Only handle CSS language clicks when there's an error
|
|
83
|
+
if (data.language !== "css" || !cssLspError) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
editor.debug("css-lsp: Status clicked, showing help popup");
|
|
88
|
+
|
|
89
|
+
// Show action popup with install options
|
|
90
|
+
editor.showActionPopup({
|
|
91
|
+
id: "css-lsp-help",
|
|
92
|
+
title: "CSS Language Server Not Found",
|
|
93
|
+
message: `"${cssLspError.serverCommand}" provides code completion, diagnostics, and formatting for CSS files. Copy the command below to install it.`,
|
|
94
|
+
actions: [
|
|
95
|
+
{ id: "copy_npm", label: `Copy: ${INSTALL_COMMANDS.npm}` },
|
|
96
|
+
{ id: "disable", label: "Disable CSS 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_css_lsp_status_clicked");
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Handle action popup results for CSS LSP help
|
|
107
|
+
*/
|
|
108
|
+
globalThis.on_css_lsp_action_result = function (
|
|
109
|
+
data: ActionPopupResultData
|
|
110
|
+
): void {
|
|
111
|
+
// Only handle our popup
|
|
112
|
+
if (data.popup_id !== "css-lsp-help") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
editor.debug(`css-lsp: Action selected - ${data.action_id}`);
|
|
117
|
+
|
|
118
|
+
switch (data.action_id) {
|
|
119
|
+
case "copy_npm":
|
|
120
|
+
editor.setClipboard(INSTALL_COMMANDS.npm);
|
|
121
|
+
editor.setStatus("Copied: " + INSTALL_COMMANDS.npm);
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case "disable":
|
|
125
|
+
editor.disableLspForLanguage("css");
|
|
126
|
+
editor.setStatus("CSS LSP disabled");
|
|
127
|
+
cssLspError = 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(`css-lsp: Unknown action: ${data.action_id}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// Register hook for action popup results
|
|
141
|
+
editor.on("action_popup_result", "on_css_lsp_action_result");
|
|
142
|
+
|
|
143
|
+
editor.debug("css-lsp: Plugin loaded");
|