@fresh-editor/fresh-editor 0.1.86 → 0.1.88

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +4 -0
  3. package/package.json +1 -1
  4. package/plugins/README.md +1 -0
  5. package/plugins/audit_mode.ts +38 -34
  6. package/plugins/calculator.i18n.json +13 -13
  7. package/plugins/calculator.ts +6 -6
  8. package/plugins/clangd_support.i18n.json +26 -26
  9. package/plugins/config-schema.json +180 -116
  10. package/plugins/csharp_support.i18n.json +52 -52
  11. package/plugins/csharp_support.ts +214 -41
  12. package/plugins/examples/virtual_buffer_demo.ts +4 -4
  13. package/plugins/find_references.i18n.json +91 -91
  14. package/plugins/git_blame.ts +3 -3
  15. package/plugins/git_explorer.ts +3 -2
  16. package/plugins/git_log.i18n.json +182 -182
  17. package/plugins/git_log.ts +10 -10
  18. package/plugins/java-lsp.ts +65 -0
  19. package/plugins/latex-lsp.ts +65 -0
  20. package/plugins/lib/finder.ts +32 -32
  21. package/plugins/lib/fresh.d.ts +432 -17
  22. package/plugins/lib/panel-manager.ts +7 -7
  23. package/plugins/lib/search-utils.ts +13 -13
  24. package/plugins/lib/virtual-buffer-factory.ts +16 -14
  25. package/plugins/live_grep.i18n.json +39 -39
  26. package/plugins/markdown_compose.i18n.json +13 -13
  27. package/plugins/markdown_compose.ts +4 -4
  28. package/plugins/marksman-lsp.ts +65 -0
  29. package/plugins/merge_conflict.i18n.json +143 -143
  30. package/plugins/merge_conflict.ts +21 -21
  31. package/plugins/search_replace.i18n.json +143 -143
  32. package/plugins/search_replace.ts +6 -6
  33. package/plugins/templ-lsp.ts +65 -0
  34. package/plugins/theme_editor.i18n.json +3797 -3745
  35. package/plugins/theme_editor.ts +6 -5
  36. package/plugins/vi_mode.ts +2 -2
  37. package/plugins/zig-lsp.ts +65 -0
  38. package/themes/dracula.json +26 -5
  39. package/plugins/csharp-lsp.ts +0 -147
@@ -1734,15 +1734,16 @@ async function doOpenThemeEditor(): Promise<void> {
1734
1734
 
1735
1735
  // Create virtual buffer in current split (no new split)
1736
1736
  editor.debug("[theme_editor] doOpenThemeEditor: calling createVirtualBuffer...");
1737
- const bufferId = await editor.createVirtualBuffer({
1737
+ const result = await editor.createVirtualBuffer({
1738
1738
  name: "*Theme Editor*",
1739
1739
  mode: "theme-editor",
1740
- read_only: true,
1740
+ readOnly: true,
1741
1741
  entries: entries,
1742
- show_line_numbers: false,
1743
- show_cursors: true,
1744
- editing_disabled: true,
1742
+ showLineNumbers: false,
1743
+ showCursors: true,
1744
+ editingDisabled: true,
1745
1745
  });
1746
+ const bufferId = result.bufferId;
1746
1747
  editor.debug(`[theme_editor] doOpenThemeEditor: createVirtualBuffer returned bufferId=${bufferId}`);
1747
1748
  editor.debug(`[theme_editor] doOpenThemeEditor: checking if bufferId !== null...`);
1748
1749
 
@@ -795,7 +795,7 @@ globalThis.vi_visual_toggle_line = function (): void {
795
795
  };
796
796
 
797
797
  // Enter visual block mode (Ctrl-v)
798
- globalThis.vi_visual_block = function (): void {
798
+ globalThis.vi_visual_block = async function (): Promise<void> {
799
799
  // Store anchor position for block selection
800
800
  state.visualAnchor = editor.getCursorPosition();
801
801
 
@@ -803,7 +803,7 @@ globalThis.vi_visual_block = function (): void {
803
803
  const cursorPos = editor.getCursorPosition();
804
804
  if (cursorPos !== null) {
805
805
  const line = editor.getCursorLine() ?? 1;
806
- const lineStart = editor.getLineStartPosition(line);
806
+ const lineStart = await editor.getLineStartPosition(line);
807
807
  const col = lineStart !== null ? cursorPos - lineStart : 0;
808
808
  state.visualBlockAnchor = { line, col };
809
809
  }
@@ -0,0 +1,65 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+ // Provides installation help when zls (Zig LSP) is not found
3
+ const editor = getEditor();
4
+
5
+ interface LspServerErrorData {
6
+ language: string;
7
+ server_command: string;
8
+ error_type: string;
9
+ message: string;
10
+ }
11
+
12
+ interface LspStatusClickedData {
13
+ language: string;
14
+ has_error: boolean;
15
+ }
16
+
17
+ interface ActionPopupResultData {
18
+ popup_id: string;
19
+ action_id: string;
20
+ }
21
+
22
+ const INSTALL_URL = "https://github.com/zigtools/zls#installation";
23
+ let zigLspError: { serverCommand: string; message: string } | null = null;
24
+
25
+ globalThis.on_zig_lsp_server_error = function (data: LspServerErrorData): void {
26
+ if (data.language !== "zig") return;
27
+ zigLspError = { serverCommand: data.server_command, message: data.message };
28
+ if (data.error_type === "not_found") {
29
+ editor.setStatus(`Zig LSP '${data.server_command}' not found. Click status bar for help.`);
30
+ } else {
31
+ editor.setStatus(`Zig LSP error: ${data.message}`);
32
+ }
33
+ };
34
+ editor.on("lsp_server_error", "on_zig_lsp_server_error");
35
+
36
+ globalThis.on_zig_lsp_status_clicked = function (data: LspStatusClickedData): void {
37
+ if (data.language !== "zig" || !zigLspError) return;
38
+ editor.showActionPopup({
39
+ id: "zig-lsp-help",
40
+ title: "Zig Language Server Not Found",
41
+ message: `Install zls for code completion and diagnostics. Visit ${INSTALL_URL}`,
42
+ actions: [
43
+ { id: "copy_url", label: "Copy install URL" },
44
+ { id: "disable", label: "Disable Zig LSP" },
45
+ { id: "dismiss", label: "Dismiss (ESC)" },
46
+ ],
47
+ });
48
+ };
49
+ editor.on("lsp_status_clicked", "on_zig_lsp_status_clicked");
50
+
51
+ globalThis.on_zig_lsp_action_result = function (data: ActionPopupResultData): void {
52
+ if (data.popup_id !== "zig-lsp-help") return;
53
+ switch (data.action_id) {
54
+ case "copy_url":
55
+ editor.setClipboard(INSTALL_URL);
56
+ editor.setStatus("Copied: " + INSTALL_URL);
57
+ break;
58
+ case "disable":
59
+ editor.disableLspForLanguage("zig");
60
+ editor.setStatus("Zig LSP disabled");
61
+ zigLspError = null;
62
+ break;
63
+ }
64
+ };
65
+ editor.on("action_popup_result", "on_zig_lsp_action_result");
@@ -5,7 +5,7 @@
5
5
  "fg": [248, 248, 242],
6
6
  "cursor": [255, 121, 198],
7
7
  "selection_bg": [68, 71, 90],
8
- "current_line_bg": [68, 71, 90],
8
+ "current_line_bg": [50, 52, 66],
9
9
  "line_number_fg": [98, 114, 164],
10
10
  "line_number_bg": [40, 42, 54]
11
11
  },
@@ -15,25 +15,46 @@
15
15
  "tab_inactive_fg": [248, 248, 242],
16
16
  "tab_inactive_bg": [68, 71, 90],
17
17
  "tab_separator_bg": [40, 42, 54],
18
+ "tab_hover_bg": [80, 83, 100],
18
19
  "status_bar_fg": [40, 42, 54],
19
20
  "status_bar_bg": [189, 147, 249],
20
21
  "prompt_fg": [40, 42, 54],
21
22
  "prompt_bg": [80, 250, 123],
22
23
  "prompt_selection_fg": [248, 248, 242],
23
24
  "prompt_selection_bg": [189, 147, 249],
24
- "popup_border_fg": [98, 114, 164],
25
- "popup_bg": [68, 71, 90],
25
+ "popup_border_fg": [189, 147, 249],
26
+ "popup_bg": [40, 42, 54],
26
27
  "popup_selection_bg": [189, 147, 249],
27
28
  "popup_text_fg": [248, 248, 242],
28
- "suggestion_bg": [68, 71, 90],
29
+ "suggestion_bg": [40, 42, 54],
29
30
  "suggestion_selected_bg": [189, 147, 249],
31
+ "menu_bg": [40, 42, 54],
32
+ "menu_fg": [248, 248, 242],
33
+ "menu_active_bg": [68, 71, 90],
34
+ "menu_active_fg": [139, 233, 253],
35
+ "menu_dropdown_bg": [40, 42, 54],
36
+ "menu_dropdown_fg": [248, 248, 242],
37
+ "menu_highlight_bg": [189, 147, 249],
38
+ "menu_highlight_fg": [40, 42, 54],
39
+ "menu_border_fg": [98, 114, 164],
40
+ "menu_separator_fg": [98, 114, 164],
41
+ "menu_hover_bg": [68, 71, 90],
42
+ "menu_hover_fg": [248, 248, 242],
43
+ "menu_disabled_fg": [98, 114, 164],
44
+ "menu_disabled_bg": [40, 42, 54],
30
45
  "help_bg": [40, 42, 54],
31
46
  "help_fg": [248, 248, 242],
32
47
  "help_key_fg": [139, 233, 253],
33
48
  "help_separator_fg": [98, 114, 164],
34
49
  "help_indicator_fg": [255, 85, 85],
35
50
  "help_indicator_bg": [40, 42, 54],
36
- "split_separator_fg": [98, 114, 164]
51
+ "split_separator_fg": [98, 114, 164],
52
+ "scrollbar_track_fg": [68, 71, 90],
53
+ "scrollbar_thumb_fg": [98, 114, 164],
54
+ "scrollbar_track_hover_fg": [80, 83, 100],
55
+ "scrollbar_thumb_hover_fg": [139, 233, 253],
56
+ "settings_selected_bg": [68, 71, 90],
57
+ "settings_selected_fg": [248, 248, 242]
37
58
  },
38
59
  "search": {
39
60
  "match_bg": [241, 250, 140],
@@ -1,147 +0,0 @@
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");