@fresh-editor/fresh-editor 0.3.0 → 0.3.2

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 (86) hide show
  1. package/CHANGELOG.md +120 -2
  2. package/package.json +1 -1
  3. package/plugins/astro-lsp.ts +6 -12
  4. package/plugins/audit_mode.ts +106 -113
  5. package/plugins/bash-lsp.ts +15 -22
  6. package/plugins/clangd-lsp.ts +15 -24
  7. package/plugins/clojure-lsp.ts +9 -12
  8. package/plugins/cmake-lsp.ts +9 -12
  9. package/plugins/code-tour.ts +15 -16
  10. package/plugins/config-schema.json +49 -5
  11. package/plugins/csharp_support.ts +25 -30
  12. package/plugins/css-lsp.ts +15 -22
  13. package/plugins/dart-lsp.ts +9 -12
  14. package/plugins/dashboard.ts +118 -0
  15. package/plugins/devcontainer.i18n.json +84 -28
  16. package/plugins/devcontainer.ts +897 -170
  17. package/plugins/diagnostics_panel.ts +10 -17
  18. package/plugins/diff_nav.ts +20 -1
  19. package/plugins/elixir-lsp.ts +9 -12
  20. package/plugins/erlang-lsp.ts +9 -12
  21. package/plugins/examples/bookmarks.ts +10 -16
  22. package/plugins/find_references.ts +5 -9
  23. package/plugins/flash.ts +585 -0
  24. package/plugins/fsharp-lsp.ts +9 -12
  25. package/plugins/git_explorer.ts +16 -20
  26. package/plugins/git_gutter.ts +65 -79
  27. package/plugins/git_log.ts +8 -8
  28. package/plugins/gleam-lsp.ts +9 -12
  29. package/plugins/go-lsp.ts +15 -22
  30. package/plugins/graphql-lsp.ts +9 -12
  31. package/plugins/haskell-lsp.ts +9 -12
  32. package/plugins/html-lsp.ts +15 -24
  33. package/plugins/java-lsp.ts +9 -12
  34. package/plugins/json-lsp.ts +15 -24
  35. package/plugins/julia-lsp.ts +9 -12
  36. package/plugins/kotlin-lsp.ts +15 -22
  37. package/plugins/latex-lsp.ts +9 -12
  38. package/plugins/lib/fresh.d.ts +378 -0
  39. package/plugins/live_diff.i18n.json +450 -0
  40. package/plugins/live_diff.ts +946 -0
  41. package/plugins/lua-lsp.ts +15 -22
  42. package/plugins/markdown_compose.ts +78 -122
  43. package/plugins/markdown_source.ts +8 -10
  44. package/plugins/marksman-lsp.ts +9 -12
  45. package/plugins/merge_conflict.ts +15 -17
  46. package/plugins/nim-lsp.ts +9 -12
  47. package/plugins/nix-lsp.ts +9 -12
  48. package/plugins/nushell-lsp.ts +9 -12
  49. package/plugins/ocaml-lsp.ts +9 -12
  50. package/plugins/odin-lsp.ts +15 -22
  51. package/plugins/path_complete.ts +5 -6
  52. package/plugins/perl-lsp.ts +9 -12
  53. package/plugins/php-lsp.ts +15 -22
  54. package/plugins/pkg.ts +10 -21
  55. package/plugins/protobuf-lsp.ts +9 -12
  56. package/plugins/python-lsp.ts +15 -24
  57. package/plugins/r-lsp.ts +9 -12
  58. package/plugins/ruby-lsp.ts +15 -22
  59. package/plugins/rust-lsp.ts +18 -28
  60. package/plugins/scala-lsp.ts +9 -12
  61. package/plugins/schemas/theme.schema.json +66 -0
  62. package/plugins/search_replace.ts +10 -13
  63. package/plugins/solidity-lsp.ts +9 -12
  64. package/plugins/sql-lsp.ts +9 -12
  65. package/plugins/svelte-lsp.ts +9 -12
  66. package/plugins/swift-lsp.ts +9 -12
  67. package/plugins/tailwindcss-lsp.ts +9 -12
  68. package/plugins/templ-lsp.ts +9 -12
  69. package/plugins/terraform-lsp.ts +9 -12
  70. package/plugins/theme_editor.i18n.json +182 -14
  71. package/plugins/theme_editor.ts +152 -208
  72. package/plugins/toml-lsp.ts +15 -22
  73. package/plugins/tsconfig.json +101 -0
  74. package/plugins/typescript-lsp.ts +15 -24
  75. package/plugins/typst-lsp.ts +15 -22
  76. package/plugins/vi_mode.ts +77 -290
  77. package/plugins/vue-lsp.ts +9 -12
  78. package/plugins/yaml-lsp.ts +15 -22
  79. package/plugins/zig-lsp.ts +9 -12
  80. package/themes/dark.json +2 -0
  81. package/themes/dracula.json +2 -0
  82. package/themes/high-contrast.json +2 -0
  83. package/themes/light.json +2 -0
  84. package/themes/nord.json +2 -0
  85. package/themes/nostalgia.json +2 -0
  86. package/themes/solarized-dark.json +2 -0
@@ -44,7 +44,10 @@ let odinLspError: { serverCommand: string; message: string } | null = null;
44
44
  /**
45
45
  * Handle LSP server errors for Odin
46
46
  */
47
- function on_odin_lsp_server_error(data: LspServerErrorData) : void {
47
+
48
+
49
+ // Register hook for LSP server errors
50
+ editor.on("lsp_server_error", (data) => {
48
51
  // Only handle Odin language errors
49
52
  if (data.language !== "odin") {
50
53
  return;
@@ -66,18 +69,15 @@ function on_odin_lsp_server_error(data: LspServerErrorData) : void {
66
69
  } else {
67
70
  editor.setStatus(`Odin LSP error: ${data.message}`);
68
71
  }
69
- }
70
- registerHandler("on_odin_lsp_server_error", on_odin_lsp_server_error);
71
-
72
- // Register hook for LSP server errors
73
- editor.on("lsp_server_error", "on_odin_lsp_server_error");
72
+ });
74
73
 
75
74
  /**
76
75
  * Handle status bar click when there's an Odin LSP error
77
76
  */
78
- function on_odin_lsp_status_clicked(
79
- data: LspStatusClickedData
80
- ): void {
77
+
78
+
79
+ // Register hook for status bar clicks
80
+ editor.on("lsp_status_clicked", (data) => {
81
81
  // Only handle Odin language clicks when there's an error
82
82
  if (data.language !== "odin" || !odinLspError) {
83
83
  return;
@@ -95,18 +95,15 @@ function on_odin_lsp_status_clicked(
95
95
  { id: "dismiss", label: "Dismiss (ESC)" },
96
96
  ],
97
97
  });
98
- }
99
- registerHandler("on_odin_lsp_status_clicked", on_odin_lsp_status_clicked);
100
-
101
- // Register hook for status bar clicks
102
- editor.on("lsp_status_clicked", "on_odin_lsp_status_clicked");
98
+ });
103
99
 
104
100
  /**
105
101
  * Handle action popup results for Odin LSP help
106
102
  */
107
- function on_odin_lsp_action_result(
108
- data: ActionPopupResultData
109
- ): void {
103
+
104
+
105
+ // Register hook for action popup results
106
+ editor.on("action_popup_result", (data) => {
110
107
  // Only handle our popup
111
108
  if (data.popup_id !== "odin-lsp-help") {
112
109
  return;
@@ -129,10 +126,6 @@ function on_odin_lsp_action_result(
129
126
  default:
130
127
  editor.debug(`odin-lsp: Unknown action: ${data.action_id}`);
131
128
  }
132
- }
133
- registerHandler("on_odin_lsp_action_result", on_odin_lsp_action_result);
134
-
135
- // Register hook for action popup results
136
- editor.on("action_popup_result", "on_odin_lsp_action_result");
129
+ });
137
130
 
138
131
  editor.debug("odin-lsp: Plugin loaded");
@@ -148,7 +148,10 @@ function generateCompletions(input: string): PromptSuggestion[] {
148
148
  }
149
149
 
150
150
  // Handle prompt changes for file prompts
151
- function onPathCompletePromptChanged(args: { prompt_type: string; input: string }) : boolean {
151
+
152
+
153
+ // Register event handler
154
+ editor.on("prompt_changed", (args) => {
152
155
  if (args.prompt_type !== "open-file" && args.prompt_type !== "save-file-as") {
153
156
  return true; // Not our prompt
154
157
  }
@@ -157,9 +160,5 @@ function onPathCompletePromptChanged(args: { prompt_type: string; input: string
157
160
  editor.setPromptSuggestions(suggestions);
158
161
 
159
162
  return true;
160
- }
161
- registerHandler("onPathCompletePromptChanged", onPathCompletePromptChanged);
162
-
163
- // Register event handler
164
- editor.on("prompt_changed", "onPathCompletePromptChanged");
163
+ });
165
164
 
@@ -35,7 +35,8 @@ const INSTALL_COMMANDS = {
35
35
 
36
36
  let perlLspError: { serverCommand: string; message: string } | null = null;
37
37
 
38
- function on_perl_lsp_server_error(data: LspServerErrorData): void {
38
+
39
+ editor.on("lsp_server_error", (data) => {
39
40
  if (data.language !== "perl") {
40
41
  return;
41
42
  }
@@ -54,11 +55,10 @@ function on_perl_lsp_server_error(data: LspServerErrorData): void {
54
55
  } else {
55
56
  editor.setStatus(`Perl LSP error: ${data.message}`);
56
57
  }
57
- }
58
- registerHandler("on_perl_lsp_server_error", on_perl_lsp_server_error);
59
- editor.on("lsp_server_error", "on_perl_lsp_server_error");
58
+ });
59
+
60
60
 
61
- function on_perl_lsp_status_clicked(data: LspStatusClickedData): void {
61
+ editor.on("lsp_status_clicked", (data) => {
62
62
  if (data.language !== "perl" || !perlLspError) {
63
63
  return;
64
64
  }
@@ -76,11 +76,10 @@ function on_perl_lsp_status_clicked(data: LspStatusClickedData): void {
76
76
  { id: "dismiss", label: "Dismiss (ESC)" },
77
77
  ],
78
78
  });
79
- }
80
- registerHandler("on_perl_lsp_status_clicked", on_perl_lsp_status_clicked);
81
- editor.on("lsp_status_clicked", "on_perl_lsp_status_clicked");
79
+ });
80
+
82
81
 
83
- function on_perl_lsp_action_result(data: ActionPopupResultData): void {
82
+ editor.on("action_popup_result", (data) => {
84
83
  if (data.popup_id !== "perl-lsp-help") {
85
84
  return;
86
85
  }
@@ -111,8 +110,6 @@ function on_perl_lsp_action_result(data: ActionPopupResultData): void {
111
110
  default:
112
111
  editor.debug(`perl-lsp: Unknown action: ${data.action_id}`);
113
112
  }
114
- }
115
- registerHandler("on_perl_lsp_action_result", on_perl_lsp_action_result);
116
- editor.on("action_popup_result", "on_perl_lsp_action_result");
113
+ });
117
114
 
118
115
  editor.debug("perl-lsp: Plugin loaded");
@@ -53,7 +53,10 @@ let phpLspError: { serverCommand: string; message: string } | null = null;
53
53
  /**
54
54
  * Handle LSP server errors for PHP
55
55
  */
56
- function on_php_lsp_server_error(data: LspServerErrorData): void {
56
+
57
+
58
+ // Register hook for LSP server errors
59
+ editor.on("lsp_server_error", (data) => {
57
60
  // Only handle PHP language errors
58
61
  if (data.language !== "php") {
59
62
  return;
@@ -75,18 +78,15 @@ function on_php_lsp_server_error(data: LspServerErrorData): void {
75
78
  } else {
76
79
  editor.setStatus(`PHP LSP error: ${data.message}`);
77
80
  }
78
- }
79
- registerHandler("on_php_lsp_server_error", on_php_lsp_server_error);
80
-
81
- // Register hook for LSP server errors
82
- editor.on("lsp_server_error", "on_php_lsp_server_error");
81
+ });
83
82
 
84
83
  /**
85
84
  * Handle status bar click when there's a PHP LSP error
86
85
  */
87
- function on_php_lsp_status_clicked(
88
- data: LspStatusClickedData
89
- ): void {
86
+
87
+
88
+ // Register hook for status bar clicks
89
+ editor.on("lsp_status_clicked", (data) => {
90
90
  // Only handle PHP language clicks when there's an error
91
91
  if (data.language !== "php" || !phpLspError) {
92
92
  return;
@@ -107,18 +107,15 @@ function on_php_lsp_status_clicked(
107
107
  { id: "dismiss", label: "Dismiss (ESC)" },
108
108
  ],
109
109
  });
110
- }
111
- registerHandler("on_php_lsp_status_clicked", on_php_lsp_status_clicked);
112
-
113
- // Register hook for status bar clicks
114
- editor.on("lsp_status_clicked", "on_php_lsp_status_clicked");
110
+ });
115
111
 
116
112
  /**
117
113
  * Handle action popup results for PHP LSP help
118
114
  */
119
- function on_php_lsp_action_result(
120
- data: ActionPopupResultData
121
- ): void {
115
+
116
+
117
+ // Register hook for action popup results
118
+ editor.on("action_popup_result", (data) => {
122
119
  // Only handle our popup
123
120
  if (data.popup_id !== "php-lsp-help") {
124
121
  return;
@@ -156,10 +153,6 @@ function on_php_lsp_action_result(
156
153
  default:
157
154
  editor.debug(`php-lsp: Unknown action: ${data.action_id}`);
158
155
  }
159
- }
160
- registerHandler("on_php_lsp_action_result", on_php_lsp_action_result);
161
-
162
- // Register hook for action popup results
163
- editor.on("action_popup_result", "on_php_lsp_action_result");
156
+ });
164
157
 
165
158
  editor.debug("php-lsp: Plugin loaded");
package/plugins/pkg.ts CHANGED
@@ -2456,11 +2456,9 @@ function pkg_search() : void {
2456
2456
  }
2457
2457
  registerHandler("pkg_search", pkg_search);
2458
2458
 
2459
- function onPkgSearchConfirmed(args: {
2460
- prompt_type: string;
2461
- selected_index: number | null;
2462
- input: string;
2463
- }): boolean {
2459
+
2460
+
2461
+ editor.on("prompt_confirmed", (args) => {
2464
2462
  if (args.prompt_type !== "pkg-search") return true;
2465
2463
 
2466
2464
  pkgState.searchQuery = args.input.trim();
@@ -2469,21 +2467,17 @@ function onPkgSearchConfirmed(args: {
2469
2467
  updatePkgManagerView();
2470
2468
 
2471
2469
  return true;
2472
- }
2473
- registerHandler("onPkgSearchConfirmed", onPkgSearchConfirmed);
2470
+ });
2474
2471
 
2475
- editor.on("prompt_confirmed", "onPkgSearchConfirmed");
2476
2472
 
2477
- function on_pkg_resize(): void {
2473
+ editor.on("resize", () => {
2478
2474
  if (!pkgState.isOpen) return;
2479
2475
  const viewport = editor.getViewport();
2480
2476
  if (viewport) {
2481
2477
  pkgState.viewportHeight = viewport.height;
2482
2478
  }
2483
2479
  updatePkgManagerView();
2484
- }
2485
- registerHandler("on_pkg_resize", on_pkg_resize);
2486
- editor.on("resize", "on_pkg_resize");
2480
+ });
2487
2481
 
2488
2482
  // Legacy Finder-based UI (kept for backwards compatibility)
2489
2483
  const registryFinder = new Finder<[string, RegistryEntry]>(editor, {
@@ -2580,11 +2574,9 @@ function pkg_install_url() : void {
2580
2574
  }
2581
2575
  registerHandler("pkg_install_url", pkg_install_url);
2582
2576
 
2583
- async function onPkgInstallUrlConfirmed(args: {
2584
- prompt_type: string;
2585
- selected_index: number | null;
2586
- input: string;
2587
- }): Promise<boolean> {
2577
+
2578
+
2579
+ editor.on("prompt_confirmed", async (args) => {
2588
2580
  if (args.prompt_type !== "pkg-install-url") return true;
2589
2581
 
2590
2582
  const url = args.input.trim();
@@ -2595,10 +2587,7 @@ async function onPkgInstallUrlConfirmed(args: {
2595
2587
  }
2596
2588
 
2597
2589
  return true;
2598
- }
2599
- registerHandler("onPkgInstallUrlConfirmed", onPkgInstallUrlConfirmed);
2600
-
2601
- editor.on("prompt_confirmed", "onPkgInstallUrlConfirmed");
2590
+ });
2602
2591
 
2603
2592
  /**
2604
2593
  * Open the package manager UI
@@ -49,7 +49,8 @@ let protobufLspError: { serverCommand: string; message: string } | null = null;
49
49
  /**
50
50
  * Handle LSP server errors for Protobuf
51
51
  */
52
- function on_protobuf_lsp_server_error(data: LspServerErrorData): void {
52
+
53
+ editor.on("lsp_server_error", (data) => {
53
54
  if (data.language !== "protobuf") {
54
55
  return;
55
56
  }
@@ -68,14 +69,13 @@ function on_protobuf_lsp_server_error(data: LspServerErrorData): void {
68
69
  } else {
69
70
  editor.setStatus(`Protobuf LSP error: ${data.message}`);
70
71
  }
71
- }
72
- registerHandler("on_protobuf_lsp_server_error", on_protobuf_lsp_server_error);
73
- editor.on("lsp_server_error", "on_protobuf_lsp_server_error");
72
+ });
74
73
 
75
74
  /**
76
75
  * Handle status bar click when there's a Protobuf LSP error
77
76
  */
78
- function on_protobuf_lsp_status_clicked(data: LspStatusClickedData): void {
77
+
78
+ editor.on("lsp_status_clicked", (data) => {
79
79
  if (data.language !== "protobuf" || !protobufLspError) {
80
80
  return;
81
81
  }
@@ -94,14 +94,13 @@ function on_protobuf_lsp_status_clicked(data: LspStatusClickedData): void {
94
94
  { id: "dismiss", label: "Dismiss (ESC)" },
95
95
  ],
96
96
  });
97
- }
98
- registerHandler("on_protobuf_lsp_status_clicked", on_protobuf_lsp_status_clicked);
99
- editor.on("lsp_status_clicked", "on_protobuf_lsp_status_clicked");
97
+ });
100
98
 
101
99
  /**
102
100
  * Handle action popup results for Protobuf LSP help
103
101
  */
104
- function on_protobuf_lsp_action_result(data: ActionPopupResultData): void {
102
+
103
+ editor.on("action_popup_result", (data) => {
105
104
  if (data.popup_id !== "protobuf-lsp-help") {
106
105
  return;
107
106
  }
@@ -137,8 +136,6 @@ function on_protobuf_lsp_action_result(data: ActionPopupResultData): void {
137
136
  default:
138
137
  editor.debug(`protobuf-lsp: Unknown action: ${data.action_id}`);
139
138
  }
140
- }
141
- registerHandler("on_protobuf_lsp_action_result", on_protobuf_lsp_action_result);
142
- editor.on("action_popup_result", "on_protobuf_lsp_action_result");
139
+ });
143
140
 
144
141
  editor.debug("protobuf-lsp: Plugin loaded");
@@ -49,9 +49,10 @@ let pythonLspError: { serverCommand: string; message: string } | null = null;
49
49
  /**
50
50
  * Handle LSP server errors for Python
51
51
  */
52
- function on_python_lsp_server_error(
53
- data: LspServerErrorData
54
- ): void {
52
+
53
+
54
+ // Register hook for LSP server errors
55
+ editor.on("lsp_server_error", (data) => {
55
56
  // Only handle Python language errors
56
57
  if (data.language !== "python") {
57
58
  return;
@@ -75,18 +76,15 @@ function on_python_lsp_server_error(
75
76
  } else {
76
77
  editor.setStatus(`Python LSP error: ${data.message}`);
77
78
  }
78
- }
79
- registerHandler("on_python_lsp_server_error", on_python_lsp_server_error);
80
-
81
- // Register hook for LSP server errors
82
- editor.on("lsp_server_error", "on_python_lsp_server_error");
79
+ });
83
80
 
84
81
  /**
85
82
  * Handle status bar click when there's a Python LSP error
86
83
  */
87
- function on_python_lsp_status_clicked(
88
- data: LspStatusClickedData
89
- ): void {
84
+
85
+
86
+ // Register hook for status bar clicks
87
+ editor.on("lsp_status_clicked", (data) => {
90
88
  // Only handle Python language clicks when there's an error
91
89
  if (data.language !== "python" || !pythonLspError) {
92
90
  return;
@@ -107,18 +105,15 @@ function on_python_lsp_status_clicked(
107
105
  { id: "dismiss", label: "Dismiss (ESC)" },
108
106
  ],
109
107
  });
110
- }
111
- registerHandler("on_python_lsp_status_clicked", on_python_lsp_status_clicked);
112
-
113
- // Register hook for status bar clicks
114
- editor.on("lsp_status_clicked", "on_python_lsp_status_clicked");
108
+ });
115
109
 
116
110
  /**
117
111
  * Handle action popup results for Python LSP help
118
112
  */
119
- function on_python_lsp_action_result(
120
- data: ActionPopupResultData
121
- ): void {
113
+
114
+
115
+ // Register hook for action popup results
116
+ editor.on("action_popup_result", (data) => {
122
117
  // Only handle our popup
123
118
  if (data.popup_id !== "python-lsp-help") {
124
119
  return;
@@ -156,10 +151,6 @@ function on_python_lsp_action_result(
156
151
  default:
157
152
  editor.debug(`python-lsp: Unknown action: ${data.action_id}`);
158
153
  }
159
- }
160
- registerHandler("on_python_lsp_action_result", on_python_lsp_action_result);
161
-
162
- // Register hook for action popup results
163
- editor.on("action_popup_result", "on_python_lsp_action_result");
154
+ });
164
155
 
165
156
  editor.debug("python-lsp: Plugin loaded");
package/plugins/r-lsp.ts CHANGED
@@ -35,7 +35,8 @@ const INSTALL_COMMANDS = {
35
35
 
36
36
  let rLspError: { serverCommand: string; message: string } | null = null;
37
37
 
38
- function on_r_lsp_server_error(data: LspServerErrorData): void {
38
+
39
+ editor.on("lsp_server_error", (data) => {
39
40
  if (data.language !== "r") {
40
41
  return;
41
42
  }
@@ -54,11 +55,10 @@ function on_r_lsp_server_error(data: LspServerErrorData): void {
54
55
  } else {
55
56
  editor.setStatus(`R LSP error: ${data.message}`);
56
57
  }
57
- }
58
- registerHandler("on_r_lsp_server_error", on_r_lsp_server_error);
59
- editor.on("lsp_server_error", "on_r_lsp_server_error");
58
+ });
59
+
60
60
 
61
- function on_r_lsp_status_clicked(data: LspStatusClickedData): void {
61
+ editor.on("lsp_status_clicked", (data) => {
62
62
  if (data.language !== "r" || !rLspError) {
63
63
  return;
64
64
  }
@@ -76,11 +76,10 @@ function on_r_lsp_status_clicked(data: LspStatusClickedData): void {
76
76
  { id: "dismiss", label: "Dismiss (ESC)" },
77
77
  ],
78
78
  });
79
- }
80
- registerHandler("on_r_lsp_status_clicked", on_r_lsp_status_clicked);
81
- editor.on("lsp_status_clicked", "on_r_lsp_status_clicked");
79
+ });
80
+
82
81
 
83
- function on_r_lsp_action_result(data: ActionPopupResultData): void {
82
+ editor.on("action_popup_result", (data) => {
84
83
  if (data.popup_id !== "r-lsp-help") {
85
84
  return;
86
85
  }
@@ -111,8 +110,6 @@ function on_r_lsp_action_result(data: ActionPopupResultData): void {
111
110
  default:
112
111
  editor.debug(`r-lsp: Unknown action: ${data.action_id}`);
113
112
  }
114
- }
115
- registerHandler("on_r_lsp_action_result", on_r_lsp_action_result);
116
- editor.on("action_popup_result", "on_r_lsp_action_result");
113
+ });
117
114
 
118
115
  editor.debug("r-lsp: Plugin loaded");
@@ -53,7 +53,10 @@ let rubyLspError: { serverCommand: string; message: string } | null = null;
53
53
  /**
54
54
  * Handle LSP server errors for Ruby
55
55
  */
56
- function on_ruby_lsp_server_error(data: LspServerErrorData): void {
56
+
57
+
58
+ // Register hook for LSP server errors
59
+ editor.on("lsp_server_error", (data) => {
57
60
  // Only handle Ruby language errors
58
61
  if (data.language !== "ruby") {
59
62
  return;
@@ -75,18 +78,15 @@ function on_ruby_lsp_server_error(data: LspServerErrorData): void {
75
78
  } else {
76
79
  editor.setStatus(`Ruby LSP error: ${data.message}`);
77
80
  }
78
- }
79
- registerHandler("on_ruby_lsp_server_error", on_ruby_lsp_server_error);
80
-
81
- // Register hook for LSP server errors
82
- editor.on("lsp_server_error", "on_ruby_lsp_server_error");
81
+ });
83
82
 
84
83
  /**
85
84
  * Handle status bar click when there's a Ruby LSP error
86
85
  */
87
- function on_ruby_lsp_status_clicked(
88
- data: LspStatusClickedData
89
- ): void {
86
+
87
+
88
+ // Register hook for status bar clicks
89
+ editor.on("lsp_status_clicked", (data) => {
90
90
  // Only handle Ruby language clicks when there's an error
91
91
  if (data.language !== "ruby" || !rubyLspError) {
92
92
  return;
@@ -107,18 +107,15 @@ function on_ruby_lsp_status_clicked(
107
107
  { id: "dismiss", label: "Dismiss (ESC)" },
108
108
  ],
109
109
  });
110
- }
111
- registerHandler("on_ruby_lsp_status_clicked", on_ruby_lsp_status_clicked);
112
-
113
- // Register hook for status bar clicks
114
- editor.on("lsp_status_clicked", "on_ruby_lsp_status_clicked");
110
+ });
115
111
 
116
112
  /**
117
113
  * Handle action popup results for Ruby LSP help
118
114
  */
119
- function on_ruby_lsp_action_result(
120
- data: ActionPopupResultData
121
- ): void {
115
+
116
+
117
+ // Register hook for action popup results
118
+ editor.on("action_popup_result", (data) => {
122
119
  // Only handle our popup
123
120
  if (data.popup_id !== "ruby-lsp-help") {
124
121
  return;
@@ -156,10 +153,6 @@ function on_ruby_lsp_action_result(
156
153
  default:
157
154
  editor.debug(`ruby-lsp: Unknown action: ${data.action_id}`);
158
155
  }
159
- }
160
- registerHandler("on_ruby_lsp_action_result", on_ruby_lsp_action_result);
161
-
162
- // Register hook for action popup results
163
- editor.on("action_popup_result", "on_ruby_lsp_action_result");
156
+ });
164
157
 
165
158
  editor.debug("ruby-lsp: Plugin loaded");
@@ -48,9 +48,10 @@ let rustLspError: { serverCommand: string; message: string } | null = null;
48
48
  /**
49
49
  * Handle LSP server errors for Rust
50
50
  */
51
- function on_rust_lsp_server_error(
52
- data: LspServerErrorData
53
- ): void {
51
+
52
+
53
+ // Register hook for LSP server errors
54
+ editor.on("lsp_server_error", (data) => {
54
55
  // Only handle Rust language errors
55
56
  if (data.language !== "rust") {
56
57
  return;
@@ -72,18 +73,15 @@ function on_rust_lsp_server_error(
72
73
  } else {
73
74
  editor.setStatus(`Rust LSP error: ${data.message}`);
74
75
  }
75
- }
76
- registerHandler("on_rust_lsp_server_error", on_rust_lsp_server_error);
77
-
78
- // Register hook for LSP server errors
79
- editor.on("lsp_server_error", "on_rust_lsp_server_error");
76
+ });
80
77
 
81
78
  /**
82
79
  * Handle status bar click when there's a Rust LSP error
83
80
  */
84
- function on_rust_lsp_status_clicked(
85
- data: LspStatusClickedData
86
- ): void {
81
+
82
+
83
+ // Register hook for status bar clicks
84
+ editor.on("lsp_status_clicked", (data) => {
87
85
  editor.debug(
88
86
  `rust-lsp: lsp_status_clicked hook received - language=${data.language}, has_error=${data.has_error}, rustLspError=${rustLspError ? "SET" : "NULL"}`
89
87
  );
@@ -111,18 +109,15 @@ function on_rust_lsp_status_clicked(
111
109
  ],
112
110
  });
113
111
  editor.debug(`rust-lsp: showActionPopup returned ${result}`);
114
- }
115
- registerHandler("on_rust_lsp_status_clicked", on_rust_lsp_status_clicked);
116
-
117
- // Register hook for status bar clicks
118
- editor.on("lsp_status_clicked", "on_rust_lsp_status_clicked");
112
+ });
119
113
 
120
114
  /**
121
115
  * Handle action popup results for Rust LSP help
122
116
  */
123
- function on_rust_lsp_action_result(
124
- data: ActionPopupResultData
125
- ): void {
117
+
118
+
119
+ // Register hook for action popup results
120
+ editor.on("action_popup_result", (data) => {
126
121
  editor.debug(
127
122
  `rust-lsp: action_popup_result received - popup_id=${data.popup_id}, action_id=${data.action_id}`
128
123
  );
@@ -160,11 +155,7 @@ function on_rust_lsp_action_result(
160
155
  default:
161
156
  editor.debug(`rust-lsp: Unknown action: ${data.action_id}`);
162
157
  }
163
- }
164
- registerHandler("on_rust_lsp_action_result", on_rust_lsp_action_result);
165
-
166
- // Register hook for action popup results
167
- editor.on("action_popup_result", "on_rust_lsp_action_result");
158
+ });
168
159
 
169
160
  // =====================================================================
170
161
  // Rust LSP mode switching (Full vs Reduced Memory)
@@ -221,7 +212,8 @@ editor.registerCommand(
221
212
  null
222
213
  );
223
214
 
224
- function on_rust_lsp_mode_selected(data: ActionPopupResultData): void {
215
+
216
+ editor.on("action_popup_result", (data) => {
225
217
  if (data.popup_id !== "rust-lsp-mode") {
226
218
  return;
227
219
  }
@@ -255,8 +247,6 @@ function on_rust_lsp_mode_selected(data: ActionPopupResultData): void {
255
247
  case "dismissed":
256
248
  break;
257
249
  }
258
- }
259
- registerHandler("on_rust_lsp_mode_selected", on_rust_lsp_mode_selected);
260
- editor.on("action_popup_result", "on_rust_lsp_mode_selected");
250
+ });
261
251
 
262
252
  editor.debug("rust-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let scalaLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_scala_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "scala") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_scala_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`Scala LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_scala_lsp_server_error", on_scala_lsp_server_error);
60
- editor.on("lsp_server_error", "on_scala_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_scala_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "scala" || !scalaLspError) {
64
64
  return;
65
65
  }
@@ -77,11 +77,10 @@ function on_scala_lsp_status_clicked(data: LspStatusClickedData): void {
77
77
  { id: "dismiss", label: "Dismiss (ESC)" },
78
78
  ],
79
79
  });
80
- }
81
- registerHandler("on_scala_lsp_status_clicked", on_scala_lsp_status_clicked);
82
- editor.on("lsp_status_clicked", "on_scala_lsp_status_clicked");
80
+ });
81
+
83
82
 
84
- function on_scala_lsp_action_result(data: ActionPopupResultData): void {
83
+ editor.on("action_popup_result", (data) => {
85
84
  if (data.popup_id !== "scala-lsp-help") {
86
85
  return;
87
86
  }
@@ -112,8 +111,6 @@ function on_scala_lsp_action_result(data: ActionPopupResultData): void {
112
111
  default:
113
112
  editor.debug(`scala-lsp: Unknown action: ${data.action_id}`);
114
113
  }
115
- }
116
- registerHandler("on_scala_lsp_action_result", on_scala_lsp_action_result);
117
- editor.on("action_popup_result", "on_scala_lsp_action_result");
114
+ });
118
115
 
119
116
  editor.debug("scala-lsp: Plugin loaded");