@fresh-editor/fresh-editor 0.2.25 → 0.3.1

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 (82) hide show
  1. package/CHANGELOG.md +216 -0
  2. package/README.md +6 -0
  3. package/package.json +1 -1
  4. package/plugins/astro-lsp.ts +6 -12
  5. package/plugins/audit_mode.i18n.json +14 -14
  6. package/plugins/audit_mode.ts +182 -146
  7. package/plugins/bash-lsp.ts +15 -22
  8. package/plugins/clangd-lsp.ts +15 -24
  9. package/plugins/clojure-lsp.ts +9 -12
  10. package/plugins/cmake-lsp.ts +9 -12
  11. package/plugins/code-tour.ts +15 -16
  12. package/plugins/config-schema.json +79 -6
  13. package/plugins/csharp_support.ts +25 -30
  14. package/plugins/css-lsp.ts +15 -22
  15. package/plugins/dart-lsp.ts +9 -12
  16. package/plugins/dashboard.ts +1903 -0
  17. package/plugins/devcontainer.i18n.json +1472 -0
  18. package/plugins/devcontainer.ts +2793 -0
  19. package/plugins/diagnostics_panel.ts +10 -17
  20. package/plugins/elixir-lsp.ts +9 -12
  21. package/plugins/erlang-lsp.ts +9 -12
  22. package/plugins/examples/bookmarks.ts +10 -16
  23. package/plugins/find_references.ts +5 -9
  24. package/plugins/flash.ts +577 -0
  25. package/plugins/fsharp-lsp.ts +9 -12
  26. package/plugins/git_explorer.ts +16 -20
  27. package/plugins/git_gutter.ts +65 -79
  28. package/plugins/git_log.i18n.json +14 -42
  29. package/plugins/git_log.ts +19 -9
  30. package/plugins/gleam-lsp.ts +9 -12
  31. package/plugins/go-lsp.ts +15 -22
  32. package/plugins/graphql-lsp.ts +9 -12
  33. package/plugins/haskell-lsp.ts +9 -12
  34. package/plugins/html-lsp.ts +15 -24
  35. package/plugins/java-lsp.ts +9 -12
  36. package/plugins/json-lsp.ts +15 -24
  37. package/plugins/julia-lsp.ts +9 -12
  38. package/plugins/kotlin-lsp.ts +15 -22
  39. package/plugins/latex-lsp.ts +9 -12
  40. package/plugins/lib/fresh.d.ts +603 -0
  41. package/plugins/lua-lsp.ts +15 -22
  42. package/plugins/markdown_compose.ts +132 -128
  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 +126 -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 +98 -14
  71. package/plugins/theme_editor.ts +156 -209
  72. package/plugins/toml-lsp.ts +15 -22
  73. package/plugins/tsconfig.json +100 -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/high-contrast.json +2 -2
  81. package/themes/nord.json +4 -0
  82. package/themes/solarized-dark.json +4 -0
@@ -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");
@@ -128,6 +128,30 @@
128
128
  35
129
129
  ]
130
130
  },
131
+ "diff_add_highlight_bg": {
132
+ "description": "Diff added word-level highlight background (optional override)\nWhen not set, computed by brightening diff_add_bg",
133
+ "anyOf": [
134
+ {
135
+ "$ref": "#/$defs/ColorDef"
136
+ },
137
+ {
138
+ "type": "null"
139
+ }
140
+ ],
141
+ "default": null
142
+ },
143
+ "diff_remove_highlight_bg": {
144
+ "description": "Diff removed word-level highlight background (optional override)\nWhen not set, computed by brightening diff_remove_bg",
145
+ "anyOf": [
146
+ {
147
+ "$ref": "#/$defs/ColorDef"
148
+ },
149
+ {
150
+ "type": "null"
151
+ }
152
+ ],
153
+ "default": null
154
+ },
131
155
  "diff_modify_bg": {
132
156
  "description": "Diff modified line background",
133
157
  "$ref": "#/$defs/ColorDef",
@@ -154,6 +178,18 @@
154
178
  70,
155
179
  70
156
180
  ]
181
+ },
182
+ "after_eof_bg": {
183
+ "description": "Background color for lines after end-of-file (optional override).\nWhen not set, computed as a slightly contrasting shade of `bg`\n(lighter for dark themes, darker for light themes) to give post-EOF\nrows a subtle visual separation from the buffer content.",
184
+ "anyOf": [
185
+ {
186
+ "$ref": "#/$defs/ColorDef"
187
+ },
188
+ {
189
+ "type": "null"
190
+ }
191
+ ],
192
+ "default": null
157
193
  }
158
194
  }
159
195
  },
@@ -662,6 +698,78 @@
662
698
  255,
663
699
  255
664
700
  ]
701
+ },
702
+ "file_status_added_fg": {
703
+ "description": "File status: added file color in file explorer (falls back to diagnostic.info_fg)",
704
+ "anyOf": [
705
+ {
706
+ "$ref": "#/$defs/ColorDef"
707
+ },
708
+ {
709
+ "type": "null"
710
+ }
711
+ ],
712
+ "default": null
713
+ },
714
+ "file_status_modified_fg": {
715
+ "description": "File status: modified file color in file explorer (falls back to diagnostic.warning_fg)",
716
+ "anyOf": [
717
+ {
718
+ "$ref": "#/$defs/ColorDef"
719
+ },
720
+ {
721
+ "type": "null"
722
+ }
723
+ ],
724
+ "default": null
725
+ },
726
+ "file_status_deleted_fg": {
727
+ "description": "File status: deleted file color in file explorer (falls back to diagnostic.error_fg)",
728
+ "anyOf": [
729
+ {
730
+ "$ref": "#/$defs/ColorDef"
731
+ },
732
+ {
733
+ "type": "null"
734
+ }
735
+ ],
736
+ "default": null
737
+ },
738
+ "file_status_renamed_fg": {
739
+ "description": "File status: renamed file color in file explorer (falls back to diagnostic.info_fg)",
740
+ "anyOf": [
741
+ {
742
+ "$ref": "#/$defs/ColorDef"
743
+ },
744
+ {
745
+ "type": "null"
746
+ }
747
+ ],
748
+ "default": null
749
+ },
750
+ "file_status_untracked_fg": {
751
+ "description": "File status: untracked file color in file explorer (falls back to diagnostic.hint_fg)",
752
+ "anyOf": [
753
+ {
754
+ "$ref": "#/$defs/ColorDef"
755
+ },
756
+ {
757
+ "type": "null"
758
+ }
759
+ ],
760
+ "default": null
761
+ },
762
+ "file_status_conflicted_fg": {
763
+ "description": "File status: conflicted file color in file explorer (falls back to diagnostic.error_fg)",
764
+ "anyOf": [
765
+ {
766
+ "$ref": "#/$defs/ColorDef"
767
+ },
768
+ {
769
+ "type": "null"
770
+ }
771
+ ],
772
+ "default": null
665
773
  }
666
774
  }
667
775
  },
@@ -686,6 +794,24 @@
686
794
  255,
687
795
  255
688
796
  ]
797
+ },
798
+ "label_bg": {
799
+ "description": "Background color for jump labels (e.g. flash plugin labels).\nShould be visually distinct from `match_bg` so labels stand\nout against highlighted matches. Default: bright magenta.",
800
+ "$ref": "#/$defs/ColorDef",
801
+ "default": [
802
+ 199,
803
+ 78,
804
+ 189
805
+ ]
806
+ },
807
+ "label_fg": {
808
+ "description": "Foreground color for jump labels. Should be high contrast\nagainst `label_bg` so the single label letter is unambiguous\neven on small terminal cells. Default: white.",
809
+ "$ref": "#/$defs/ColorDef",
810
+ "default": [
811
+ 255,
812
+ 255,
813
+ 255
814
+ ]
689
815
  }
690
816
  }
691
817
  },
@@ -1255,7 +1255,9 @@ registerHandler("start_search_replace", start_search_replace);
1255
1255
  // Event handlers (resize updates width)
1256
1256
  // =============================================================================
1257
1257
 
1258
- function onSearchReplaceResize(data: { width: number; height: number }): void {
1258
+
1259
+
1260
+ editor.on("resize", (data) => {
1259
1261
  if (!panel) return;
1260
1262
  // Try viewport first (gives actual split width), fall back to terminal width estimate
1261
1263
  const vp = editor.getViewport();
@@ -1266,31 +1268,26 @@ function onSearchReplaceResize(data: { width: number; height: number }): void {
1266
1268
  panel.viewportWidth = Math.floor(data.width * 0.4);
1267
1269
  }
1268
1270
  updatePanelContent();
1269
- }
1270
- registerHandler("onSearchReplaceResize", onSearchReplaceResize);
1271
-
1272
- editor.on("resize", "onSearchReplaceResize");
1271
+ });
1273
1272
 
1274
1273
  // Prompt handlers (in case prompts are opened externally for this panel - gracefully handle)
1275
- function onSearchReplacePromptCancelled(args: { prompt_type: string }): boolean {
1274
+
1275
+ editor.on("prompt_cancelled", (args) => {
1276
1276
  if (!args.prompt_type.startsWith("search-replace-")) return true;
1277
1277
  return true;
1278
- }
1279
- registerHandler("onSearchReplacePromptCancelled", onSearchReplacePromptCancelled);
1280
- editor.on("prompt_cancelled", "onSearchReplacePromptCancelled");
1278
+ });
1281
1279
 
1282
1280
  // If the panel's virtual buffer is closed externally (via the × button,
1283
1281
  // the Close Buffer/Close Tab commands, or anything else), reset the
1284
1282
  // plugin's internal state so the next invocation of `openPanel` creates
1285
1283
  // a fresh buffer/split instead of trying to update a buffer that no
1286
1284
  // longer exists (which silently no-ops and leaves the user with no UI).
1287
- function onSearchReplaceBufferClosed(args: { buffer_id: number }): void {
1285
+
1286
+ editor.on("buffer_closed", (args) => {
1288
1287
  if (panel && args.buffer_id === panel.resultsBufferId) {
1289
1288
  panel = null;
1290
1289
  }
1291
- }
1292
- registerHandler("onSearchReplaceBufferClosed", onSearchReplaceBufferClosed);
1293
- editor.on("buffer_closed", "onSearchReplaceBufferClosed");
1290
+ });
1294
1291
 
1295
1292
  editor.registerCommand(
1296
1293
  "%cmd.search_replace",
@@ -47,7 +47,8 @@ let solidityLspError: { serverCommand: string; message: string } | null = null;
47
47
  /**
48
48
  * Handle LSP server errors for Solidity
49
49
  */
50
- function on_solidity_lsp_server_error(data: LspServerErrorData): void {
50
+
51
+ editor.on("lsp_server_error", (data) => {
51
52
  if (data.language !== "solidity") {
52
53
  return;
53
54
  }
@@ -66,14 +67,13 @@ function on_solidity_lsp_server_error(data: LspServerErrorData): void {
66
67
  } else {
67
68
  editor.setStatus(`Solidity LSP error: ${data.message}`);
68
69
  }
69
- }
70
- registerHandler("on_solidity_lsp_server_error", on_solidity_lsp_server_error);
71
- editor.on("lsp_server_error", "on_solidity_lsp_server_error");
70
+ });
72
71
 
73
72
  /**
74
73
  * Handle status bar click when there's a Solidity LSP error
75
74
  */
76
- function on_solidity_lsp_status_clicked(data: LspStatusClickedData): void {
75
+
76
+ editor.on("lsp_status_clicked", (data) => {
77
77
  if (data.language !== "solidity" || !solidityLspError) {
78
78
  return;
79
79
  }
@@ -90,14 +90,13 @@ function on_solidity_lsp_status_clicked(data: LspStatusClickedData): void {
90
90
  { id: "dismiss", label: "Dismiss (ESC)" },
91
91
  ],
92
92
  });
93
- }
94
- registerHandler("on_solidity_lsp_status_clicked", on_solidity_lsp_status_clicked);
95
- editor.on("lsp_status_clicked", "on_solidity_lsp_status_clicked");
93
+ });
96
94
 
97
95
  /**
98
96
  * Handle action popup results for Solidity LSP help
99
97
  */
100
- function on_solidity_lsp_action_result(data: ActionPopupResultData): void {
98
+
99
+ editor.on("action_popup_result", (data) => {
101
100
  if (data.popup_id !== "solidity-lsp-help") {
102
101
  return;
103
102
  }
@@ -123,8 +122,6 @@ function on_solidity_lsp_action_result(data: ActionPopupResultData): void {
123
122
  default:
124
123
  editor.debug(`solidity-lsp: Unknown action: ${data.action_id}`);
125
124
  }
126
- }
127
- registerHandler("on_solidity_lsp_action_result", on_solidity_lsp_action_result);
128
- editor.on("action_popup_result", "on_solidity_lsp_action_result");
125
+ });
129
126
 
130
127
  editor.debug("solidity-lsp: Plugin loaded");
@@ -40,7 +40,8 @@ const INSTALL_COMMANDS = {
40
40
 
41
41
  let sqlLspError: { serverCommand: string; message: string } | null = null;
42
42
 
43
- function on_sql_lsp_server_error(data: LspServerErrorData): void {
43
+
44
+ editor.on("lsp_server_error", (data) => {
44
45
  if (data.language !== "sql") {
45
46
  return;
46
47
  }
@@ -59,11 +60,10 @@ function on_sql_lsp_server_error(data: LspServerErrorData): void {
59
60
  } else {
60
61
  editor.setStatus(`SQL LSP error: ${data.message}`);
61
62
  }
62
- }
63
- registerHandler("on_sql_lsp_server_error", on_sql_lsp_server_error);
64
- editor.on("lsp_server_error", "on_sql_lsp_server_error");
63
+ });
64
+
65
65
 
66
- function on_sql_lsp_status_clicked(data: LspStatusClickedData): void {
66
+ editor.on("lsp_status_clicked", (data) => {
67
67
  if (data.language !== "sql" || !sqlLspError) {
68
68
  return;
69
69
  }
@@ -82,11 +82,10 @@ function on_sql_lsp_status_clicked(data: LspStatusClickedData): void {
82
82
  { id: "dismiss", label: "Dismiss (ESC)" },
83
83
  ],
84
84
  });
85
- }
86
- registerHandler("on_sql_lsp_status_clicked", on_sql_lsp_status_clicked);
87
- editor.on("lsp_status_clicked", "on_sql_lsp_status_clicked");
85
+ });
86
+
88
87
 
89
- function on_sql_lsp_action_result(data: ActionPopupResultData): void {
88
+ editor.on("action_popup_result", (data) => {
90
89
  if (data.popup_id !== "sql-lsp-help") {
91
90
  return;
92
91
  }
@@ -122,8 +121,6 @@ function on_sql_lsp_action_result(data: ActionPopupResultData): void {
122
121
  default:
123
122
  editor.debug(`sql-lsp: Unknown action: ${data.action_id}`);
124
123
  }
125
- }
126
- registerHandler("on_sql_lsp_action_result", on_sql_lsp_action_result);
127
- editor.on("action_popup_result", "on_sql_lsp_action_result");
124
+ });
128
125
 
129
126
  editor.debug("sql-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let svelteLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_svelte_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "svelte") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_svelte_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`Svelte LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_svelte_lsp_server_error", on_svelte_lsp_server_error);
60
- editor.on("lsp_server_error", "on_svelte_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_svelte_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "svelte" || !svelteLspError) {
64
64
  return;
65
65
  }
@@ -77,11 +77,10 @@ function on_svelte_lsp_status_clicked(data: LspStatusClickedData): void {
77
77
  { id: "dismiss", label: "Dismiss (ESC)" },
78
78
  ],
79
79
  });
80
- }
81
- registerHandler("on_svelte_lsp_status_clicked", on_svelte_lsp_status_clicked);
82
- editor.on("lsp_status_clicked", "on_svelte_lsp_status_clicked");
80
+ });
81
+
83
82
 
84
- function on_svelte_lsp_action_result(data: ActionPopupResultData): void {
83
+ editor.on("action_popup_result", (data) => {
85
84
  if (data.popup_id !== "svelte-lsp-help") {
86
85
  return;
87
86
  }
@@ -112,8 +111,6 @@ function on_svelte_lsp_action_result(data: ActionPopupResultData): void {
112
111
  default:
113
112
  editor.debug(`svelte-lsp: Unknown action: ${data.action_id}`);
114
113
  }
115
- }
116
- registerHandler("on_svelte_lsp_action_result", on_svelte_lsp_action_result);
117
- editor.on("action_popup_result", "on_svelte_lsp_action_result");
114
+ });
118
115
 
119
116
  editor.debug("svelte-lsp: Plugin loaded");
@@ -37,7 +37,8 @@ const INSTALL_COMMANDS = {
37
37
 
38
38
  let swiftLspError: { serverCommand: string; message: string } | null = null;
39
39
 
40
- function on_swift_lsp_server_error(data: LspServerErrorData): void {
40
+
41
+ editor.on("lsp_server_error", (data) => {
41
42
  if (data.language !== "swift") {
42
43
  return;
43
44
  }
@@ -56,11 +57,10 @@ function on_swift_lsp_server_error(data: LspServerErrorData): void {
56
57
  } else {
57
58
  editor.setStatus(`Swift LSP error: ${data.message}`);
58
59
  }
59
- }
60
- registerHandler("on_swift_lsp_server_error", on_swift_lsp_server_error);
61
- editor.on("lsp_server_error", "on_swift_lsp_server_error");
60
+ });
61
+
62
62
 
63
- function on_swift_lsp_status_clicked(data: LspStatusClickedData): void {
63
+ editor.on("lsp_status_clicked", (data) => {
64
64
  if (data.language !== "swift" || !swiftLspError) {
65
65
  return;
66
66
  }
@@ -78,11 +78,10 @@ function on_swift_lsp_status_clicked(data: LspStatusClickedData): void {
78
78
  { id: "dismiss", label: "Dismiss (ESC)" },
79
79
  ],
80
80
  });
81
- }
82
- registerHandler("on_swift_lsp_status_clicked", on_swift_lsp_status_clicked);
83
- editor.on("lsp_status_clicked", "on_swift_lsp_status_clicked");
81
+ });
82
+
84
83
 
85
- function on_swift_lsp_action_result(data: ActionPopupResultData): void {
84
+ editor.on("action_popup_result", (data) => {
86
85
  if (data.popup_id !== "swift-lsp-help") {
87
86
  return;
88
87
  }
@@ -113,8 +112,6 @@ function on_swift_lsp_action_result(data: ActionPopupResultData): void {
113
112
  default:
114
113
  editor.debug(`swift-lsp: Unknown action: ${data.action_id}`);
115
114
  }
116
- }
117
- registerHandler("on_swift_lsp_action_result", on_swift_lsp_action_result);
118
- editor.on("action_popup_result", "on_swift_lsp_action_result");
115
+ });
119
116
 
120
117
  editor.debug("swift-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let tailwindLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_tailwindcss_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "tailwindcss") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_tailwindcss_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`Tailwind CSS LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_tailwindcss_lsp_server_error", on_tailwindcss_lsp_server_error);
60
- editor.on("lsp_server_error", "on_tailwindcss_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_tailwindcss_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "tailwindcss" || !tailwindLspError) {
64
64
  return;
65
65
  }
@@ -77,11 +77,10 @@ function on_tailwindcss_lsp_status_clicked(data: LspStatusClickedData): void {
77
77
  { id: "dismiss", label: "Dismiss (ESC)" },
78
78
  ],
79
79
  });
80
- }
81
- registerHandler("on_tailwindcss_lsp_status_clicked", on_tailwindcss_lsp_status_clicked);
82
- editor.on("lsp_status_clicked", "on_tailwindcss_lsp_status_clicked");
80
+ });
81
+
83
82
 
84
- function on_tailwindcss_lsp_action_result(data: ActionPopupResultData): void {
83
+ editor.on("action_popup_result", (data) => {
85
84
  if (data.popup_id !== "tailwindcss-lsp-help") {
86
85
  return;
87
86
  }
@@ -112,8 +111,6 @@ function on_tailwindcss_lsp_action_result(data: ActionPopupResultData): void {
112
111
  default:
113
112
  editor.debug(`tailwindcss-lsp: Unknown action: ${data.action_id}`);
114
113
  }
115
- }
116
- registerHandler("on_tailwindcss_lsp_action_result", on_tailwindcss_lsp_action_result);
117
- editor.on("action_popup_result", "on_tailwindcss_lsp_action_result");
114
+ });
118
115
 
119
116
  editor.debug("tailwindcss-lsp: Plugin loaded");
@@ -22,7 +22,8 @@ interface ActionPopupResultData {
22
22
  const INSTALL_URL = "https://templ.guide/quick-start/installation";
23
23
  let templLspError: { serverCommand: string; message: string } | null = null;
24
24
 
25
- function on_templ_lsp_server_error(data: LspServerErrorData) : void {
25
+
26
+ editor.on("lsp_server_error", (data) => {
26
27
  if (data.language !== "templ") return;
27
28
  templLspError = { serverCommand: data.server_command, message: data.message };
28
29
  if (data.error_type === "not_found") {
@@ -30,11 +31,10 @@ function on_templ_lsp_server_error(data: LspServerErrorData) : void {
30
31
  } else {
31
32
  editor.setStatus(`Templ LSP error: ${data.message}`);
32
33
  }
33
- }
34
- registerHandler("on_templ_lsp_server_error", on_templ_lsp_server_error);
35
- editor.on("lsp_server_error", "on_templ_lsp_server_error");
34
+ });
35
+
36
36
 
37
- function on_templ_lsp_status_clicked(data: LspStatusClickedData) : void {
37
+ editor.on("lsp_status_clicked", (data) => {
38
38
  if (data.language !== "templ" || !templLspError) return;
39
39
  editor.showActionPopup({
40
40
  id: "templ-lsp-help",
@@ -46,11 +46,10 @@ function on_templ_lsp_status_clicked(data: LspStatusClickedData) : void {
46
46
  { id: "dismiss", label: "Dismiss (ESC)" },
47
47
  ],
48
48
  });
49
- }
50
- registerHandler("on_templ_lsp_status_clicked", on_templ_lsp_status_clicked);
51
- editor.on("lsp_status_clicked", "on_templ_lsp_status_clicked");
49
+ });
50
+
52
51
 
53
- function on_templ_lsp_action_result(data: ActionPopupResultData) : void {
52
+ editor.on("action_popup_result", (data) => {
54
53
  if (data.popup_id !== "templ-lsp-help") return;
55
54
  switch (data.action_id) {
56
55
  case "copy_url":
@@ -63,6 +62,4 @@ function on_templ_lsp_action_result(data: ActionPopupResultData) : void {
63
62
  templLspError = null;
64
63
  break;
65
64
  }
66
- }
67
- registerHandler("on_templ_lsp_action_result", on_templ_lsp_action_result);
68
- editor.on("action_popup_result", "on_templ_lsp_action_result");
65
+ });