@fresh-editor/fresh-editor 0.3.0 → 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 (76) hide show
  1. package/CHANGELOG.md +66 -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 +10 -0
  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/elixir-lsp.ts +9 -12
  19. package/plugins/erlang-lsp.ts +9 -12
  20. package/plugins/examples/bookmarks.ts +10 -16
  21. package/plugins/find_references.ts +5 -9
  22. package/plugins/flash.ts +577 -0
  23. package/plugins/fsharp-lsp.ts +9 -12
  24. package/plugins/git_explorer.ts +16 -20
  25. package/plugins/git_gutter.ts +65 -79
  26. package/plugins/git_log.ts +8 -8
  27. package/plugins/gleam-lsp.ts +9 -12
  28. package/plugins/go-lsp.ts +15 -22
  29. package/plugins/graphql-lsp.ts +9 -12
  30. package/plugins/haskell-lsp.ts +9 -12
  31. package/plugins/html-lsp.ts +15 -24
  32. package/plugins/java-lsp.ts +9 -12
  33. package/plugins/json-lsp.ts +15 -24
  34. package/plugins/julia-lsp.ts +9 -12
  35. package/plugins/kotlin-lsp.ts +15 -22
  36. package/plugins/latex-lsp.ts +9 -12
  37. package/plugins/lib/fresh.d.ts +378 -0
  38. package/plugins/lua-lsp.ts +15 -22
  39. package/plugins/markdown_compose.ts +78 -122
  40. package/plugins/markdown_source.ts +8 -10
  41. package/plugins/marksman-lsp.ts +9 -12
  42. package/plugins/merge_conflict.ts +15 -17
  43. package/plugins/nim-lsp.ts +9 -12
  44. package/plugins/nix-lsp.ts +9 -12
  45. package/plugins/nushell-lsp.ts +9 -12
  46. package/plugins/ocaml-lsp.ts +9 -12
  47. package/plugins/odin-lsp.ts +15 -22
  48. package/plugins/path_complete.ts +5 -6
  49. package/plugins/perl-lsp.ts +9 -12
  50. package/plugins/php-lsp.ts +15 -22
  51. package/plugins/pkg.ts +10 -21
  52. package/plugins/protobuf-lsp.ts +9 -12
  53. package/plugins/python-lsp.ts +15 -24
  54. package/plugins/r-lsp.ts +9 -12
  55. package/plugins/ruby-lsp.ts +15 -22
  56. package/plugins/rust-lsp.ts +18 -28
  57. package/plugins/scala-lsp.ts +9 -12
  58. package/plugins/schemas/theme.schema.json +18 -0
  59. package/plugins/search_replace.ts +10 -13
  60. package/plugins/solidity-lsp.ts +9 -12
  61. package/plugins/sql-lsp.ts +9 -12
  62. package/plugins/svelte-lsp.ts +9 -12
  63. package/plugins/swift-lsp.ts +9 -12
  64. package/plugins/tailwindcss-lsp.ts +9 -12
  65. package/plugins/templ-lsp.ts +9 -12
  66. package/plugins/terraform-lsp.ts +9 -12
  67. package/plugins/theme_editor.i18n.json +70 -14
  68. package/plugins/theme_editor.ts +152 -208
  69. package/plugins/toml-lsp.ts +15 -22
  70. package/plugins/tsconfig.json +100 -0
  71. package/plugins/typescript-lsp.ts +15 -24
  72. package/plugins/typst-lsp.ts +15 -22
  73. package/plugins/vi_mode.ts +77 -290
  74. package/plugins/vue-lsp.ts +9 -12
  75. package/plugins/yaml-lsp.ts +15 -22
  76. package/plugins/zig-lsp.ts +9 -12
@@ -322,85 +322,17 @@ async function updateGitGutter(bufferId: number): Promise<void> {
322
322
  /**
323
323
  * Handle after file open - initialize git state and update indicators
324
324
  */
325
- function onGitGutterAfterFileOpen(args: {
326
- buffer_id: number;
327
- path: string;
328
- }): boolean {
329
- const bufferId = args.buffer_id;
330
- const filePath = args.path;
331
-
332
- if (!filePath || filePath === "") {
333
- return true;
334
- }
335
325
 
336
- // Initialize state for this buffer
337
- bufferStates.set(bufferId, {
338
- filePath,
339
- hunks: [],
340
- updating: false,
341
- });
342
-
343
- // Update immediately (no debounce for file open)
344
- updateGitGutter(bufferId);
345
-
346
- return true;
347
- }
348
- registerHandler("onGitGutterAfterFileOpen", onGitGutterAfterFileOpen);
349
326
 
350
327
  /**
351
328
  * Handle buffer activation - update if we have state but indicators might be stale
352
329
  */
353
- function onGitGutterBufferActivated(args: {
354
- buffer_id: number;
355
- }): boolean {
356
- const bufferId = args.buffer_id;
357
330
 
358
- // If we don't have state yet, try to initialize from buffer path
359
- if (!bufferStates.has(bufferId)) {
360
- const filePath = editor.getBufferPath(bufferId);
361
- if (filePath && filePath !== "") {
362
- bufferStates.set(bufferId, {
363
- filePath,
364
- hunks: [],
365
- updating: false,
366
- });
367
- updateGitGutter(bufferId);
368
- }
369
- }
370
- // If we already have state, the indicators should be current
371
- // (they update on file open and save)
372
-
373
- return true;
374
- }
375
- registerHandler("onGitGutterBufferActivated", onGitGutterBufferActivated);
376
331
 
377
332
  /**
378
333
  * Handle after file save - refresh indicators
379
334
  */
380
- function onGitGutterAfterSave(args: {
381
- buffer_id: number;
382
- path: string;
383
- }): boolean {
384
- const bufferId = args.buffer_id;
385
-
386
- // Update state with new path (in case of save-as)
387
- const state = bufferStates.get(bufferId);
388
- if (state) {
389
- state.filePath = args.path;
390
- } else {
391
- bufferStates.set(bufferId, {
392
- filePath: args.path,
393
- hunks: [],
394
- updating: false,
395
- });
396
- }
397
-
398
- // Update immediately after save (no debounce)
399
- updateGitGutter(bufferId);
400
335
 
401
- return true;
402
- }
403
- registerHandler("onGitGutterAfterSave", onGitGutterAfterSave);
404
336
 
405
337
  // Note: Git diff compares the file on disk, not the in-memory buffer.
406
338
  // Line indicators automatically track position changes via byte-position markers.
@@ -409,13 +341,7 @@ registerHandler("onGitGutterAfterSave", onGitGutterAfterSave);
409
341
  /**
410
342
  * Handle buffer closed - cleanup state
411
343
  */
412
- function onGitGutterBufferClosed(args: {
413
- buffer_id: number;
414
- }): boolean {
415
- bufferStates.delete(args.buffer_id);
416
- return true;
417
- }
418
- registerHandler("onGitGutterBufferClosed", onGitGutterBufferClosed);
344
+
419
345
 
420
346
  // =============================================================================
421
347
  // Commands
@@ -458,10 +384,70 @@ registerHandler("git_gutter_refresh", git_gutter_refresh);
458
384
  // Register event handlers
459
385
  // Note: No need to register after-insert/after-delete hooks - indicators
460
386
  // automatically track position changes via byte-position markers in the editor.
461
- editor.on("after_file_open", "onGitGutterAfterFileOpen");
462
- editor.on("buffer_activated", "onGitGutterBufferActivated");
463
- editor.on("after_file_save", "onGitGutterAfterSave");
464
- editor.on("buffer_closed", "onGitGutterBufferClosed");
387
+ editor.on("after_file_open", (args) => {
388
+ const bufferId = args.buffer_id;
389
+ const filePath = args.path;
390
+
391
+ if (!filePath || filePath === "") {
392
+ return true;
393
+ }
394
+
395
+ // Initialize state for this buffer
396
+ bufferStates.set(bufferId, {
397
+ filePath,
398
+ hunks: [],
399
+ updating: false,
400
+ });
401
+
402
+ // Update immediately (no debounce for file open)
403
+ updateGitGutter(bufferId);
404
+
405
+ return true;
406
+ });
407
+ editor.on("buffer_activated", (args) => {
408
+ const bufferId = args.buffer_id;
409
+
410
+ // If we don't have state yet, try to initialize from buffer path
411
+ if (!bufferStates.has(bufferId)) {
412
+ const filePath = editor.getBufferPath(bufferId);
413
+ if (filePath && filePath !== "") {
414
+ bufferStates.set(bufferId, {
415
+ filePath,
416
+ hunks: [],
417
+ updating: false,
418
+ });
419
+ updateGitGutter(bufferId);
420
+ }
421
+ }
422
+ // If we already have state, the indicators should be current
423
+ // (they update on file open and save)
424
+
425
+ return true;
426
+ });
427
+ editor.on("after_file_save", (args) => {
428
+ const bufferId = args.buffer_id;
429
+
430
+ // Update state with new path (in case of save-as)
431
+ const state = bufferStates.get(bufferId);
432
+ if (state) {
433
+ state.filePath = args.path;
434
+ } else {
435
+ bufferStates.set(bufferId, {
436
+ filePath: args.path,
437
+ hunks: [],
438
+ updating: false,
439
+ });
440
+ }
441
+
442
+ // Update immediately after save (no debounce)
443
+ updateGitGutter(bufferId);
444
+
445
+ return true;
446
+ });
447
+ editor.on("buffer_closed", (args) => {
448
+ bufferStates.delete(args.buffer_id);
449
+ return true;
450
+ });
465
451
 
466
452
  // Register commands
467
453
  editor.registerCommand(
@@ -488,10 +488,10 @@ async function show_git_log(): Promise<void> {
488
488
  if (state.groupId !== null) {
489
489
  editor.focusBufferGroupPanel(state.groupId, "log");
490
490
  }
491
- editor.on("cursor_moved", "on_git_log_cursor_moved");
492
- editor.on("mouse_click", "on_git_log_toolbar_click");
493
- editor.on("resize", "on_git_log_resize");
494
- editor.on("buffer_closed", "on_git_log_buffer_closed");
491
+ editor.on("cursor_moved", on_git_log_cursor_moved);
492
+ editor.on("mouse_click", on_git_log_toolbar_click);
493
+ editor.on("resize", on_git_log_resize);
494
+ editor.on("buffer_closed", on_git_log_buffer_closed);
495
495
 
496
496
  editor.setStatus(
497
497
  editor.t("status.log_ready", { count: String(state.commits.length) })
@@ -504,10 +504,10 @@ registerHandler("show_git_log", show_git_log);
504
504
  * close button, which triggers `buffer_closed`). */
505
505
  function git_log_cleanup(): void {
506
506
  if (!state.isOpen) return;
507
- editor.off("cursor_moved", "on_git_log_cursor_moved");
508
- editor.off("mouse_click", "on_git_log_toolbar_click");
509
- editor.off("resize", "on_git_log_resize");
510
- editor.off("buffer_closed", "on_git_log_buffer_closed");
507
+ editor.off("cursor_moved", on_git_log_cursor_moved);
508
+ editor.off("mouse_click", on_git_log_toolbar_click);
509
+ editor.off("resize", on_git_log_resize);
510
+ editor.off("buffer_closed", on_git_log_buffer_closed);
511
511
  state.isOpen = false;
512
512
  state.groupId = null;
513
513
  state.logBufferId = null;
@@ -35,7 +35,8 @@ const INSTALL_COMMANDS = {
35
35
 
36
36
  let gleamLspError: { serverCommand: string; message: string } | null = null;
37
37
 
38
- function on_gleam_lsp_server_error(data: LspServerErrorData): void {
38
+
39
+ editor.on("lsp_server_error", (data) => {
39
40
  if (data.language !== "gleam") {
40
41
  return;
41
42
  }
@@ -54,11 +55,10 @@ function on_gleam_lsp_server_error(data: LspServerErrorData): void {
54
55
  } else {
55
56
  editor.setStatus(`Gleam LSP error: ${data.message}`);
56
57
  }
57
- }
58
- registerHandler("on_gleam_lsp_server_error", on_gleam_lsp_server_error);
59
- editor.on("lsp_server_error", "on_gleam_lsp_server_error");
58
+ });
59
+
60
60
 
61
- function on_gleam_lsp_status_clicked(data: LspStatusClickedData): void {
61
+ editor.on("lsp_status_clicked", (data) => {
62
62
  if (data.language !== "gleam" || !gleamLspError) {
63
63
  return;
64
64
  }
@@ -77,11 +77,10 @@ function on_gleam_lsp_status_clicked(data: LspStatusClickedData): void {
77
77
  { id: "dismiss", label: "Dismiss (ESC)" },
78
78
  ],
79
79
  });
80
- }
81
- registerHandler("on_gleam_lsp_status_clicked", on_gleam_lsp_status_clicked);
82
- editor.on("lsp_status_clicked", "on_gleam_lsp_status_clicked");
80
+ });
81
+
83
82
 
84
- function on_gleam_lsp_action_result(data: ActionPopupResultData): void {
83
+ editor.on("action_popup_result", (data) => {
85
84
  if (data.popup_id !== "gleam-lsp-help") {
86
85
  return;
87
86
  }
@@ -117,8 +116,6 @@ function on_gleam_lsp_action_result(data: ActionPopupResultData): void {
117
116
  default:
118
117
  editor.debug(`gleam-lsp: Unknown action: ${data.action_id}`);
119
118
  }
120
- }
121
- registerHandler("on_gleam_lsp_action_result", on_gleam_lsp_action_result);
122
- editor.on("action_popup_result", "on_gleam_lsp_action_result");
119
+ });
123
120
 
124
121
  editor.debug("gleam-lsp: Plugin loaded");
package/plugins/go-lsp.ts CHANGED
@@ -46,7 +46,10 @@ let goLspError: { serverCommand: string; message: string } | null = null;
46
46
  /**
47
47
  * Handle LSP server errors for Go
48
48
  */
49
- function on_go_lsp_server_error(data: LspServerErrorData) : void {
49
+
50
+
51
+ // Register hook for LSP server errors
52
+ editor.on("lsp_server_error", (data) => {
50
53
  // Only handle Go language errors
51
54
  if (data.language !== "go") {
52
55
  return;
@@ -68,18 +71,15 @@ function on_go_lsp_server_error(data: LspServerErrorData) : void {
68
71
  } else {
69
72
  editor.setStatus(`Go LSP error: ${data.message}`);
70
73
  }
71
- }
72
- registerHandler("on_go_lsp_server_error", on_go_lsp_server_error);
73
-
74
- // Register hook for LSP server errors
75
- editor.on("lsp_server_error", "on_go_lsp_server_error");
74
+ });
76
75
 
77
76
  /**
78
77
  * Handle status bar click when there's a Go LSP error
79
78
  */
80
- function on_go_lsp_status_clicked(
81
- data: LspStatusClickedData
82
- ): void {
79
+
80
+
81
+ // Register hook for status bar clicks
82
+ editor.on("lsp_status_clicked", (data) => {
83
83
  // Only handle Go language clicks when there's an error
84
84
  if (data.language !== "go" || !goLspError) {
85
85
  return;
@@ -98,18 +98,15 @@ function on_go_lsp_status_clicked(
98
98
  { id: "dismiss", label: "Dismiss (ESC)" },
99
99
  ],
100
100
  });
101
- }
102
- registerHandler("on_go_lsp_status_clicked", on_go_lsp_status_clicked);
103
-
104
- // Register hook for status bar clicks
105
- editor.on("lsp_status_clicked", "on_go_lsp_status_clicked");
101
+ });
106
102
 
107
103
  /**
108
104
  * Handle action popup results for Go LSP help
109
105
  */
110
- function on_go_lsp_action_result(
111
- data: ActionPopupResultData
112
- ): void {
106
+
107
+
108
+ // Register hook for action popup results
109
+ editor.on("action_popup_result", (data) => {
113
110
  // Only handle our popup
114
111
  if (data.popup_id !== "go-lsp-help") {
115
112
  return;
@@ -137,10 +134,6 @@ function on_go_lsp_action_result(
137
134
  default:
138
135
  editor.debug(`go-lsp: Unknown action: ${data.action_id}`);
139
136
  }
140
- }
141
- registerHandler("on_go_lsp_action_result", on_go_lsp_action_result);
142
-
143
- // Register hook for action popup results
144
- editor.on("action_popup_result", "on_go_lsp_action_result");
137
+ });
145
138
 
146
139
  editor.debug("go-lsp: Plugin loaded");
@@ -50,7 +50,8 @@ let graphqlLspError: { serverCommand: string; message: string } | null = null;
50
50
  /**
51
51
  * Handle LSP server errors for GraphQL
52
52
  */
53
- function on_graphql_lsp_server_error(data: LspServerErrorData): void {
53
+
54
+ editor.on("lsp_server_error", (data) => {
54
55
  if (data.language !== "graphql") {
55
56
  return;
56
57
  }
@@ -69,14 +70,13 @@ function on_graphql_lsp_server_error(data: LspServerErrorData): void {
69
70
  } else {
70
71
  editor.setStatus(`GraphQL LSP error: ${data.message}`);
71
72
  }
72
- }
73
- registerHandler("on_graphql_lsp_server_error", on_graphql_lsp_server_error);
74
- editor.on("lsp_server_error", "on_graphql_lsp_server_error");
73
+ });
75
74
 
76
75
  /**
77
76
  * Handle status bar click when there's a GraphQL LSP error
78
77
  */
79
- function on_graphql_lsp_status_clicked(data: LspStatusClickedData): void {
78
+
79
+ editor.on("lsp_status_clicked", (data) => {
80
80
  if (data.language !== "graphql" || !graphqlLspError) {
81
81
  return;
82
82
  }
@@ -94,14 +94,13 @@ function on_graphql_lsp_status_clicked(data: LspStatusClickedData): void {
94
94
  { id: "dismiss", label: "Dismiss (ESC)" },
95
95
  ],
96
96
  });
97
- }
98
- registerHandler("on_graphql_lsp_status_clicked", on_graphql_lsp_status_clicked);
99
- editor.on("lsp_status_clicked", "on_graphql_lsp_status_clicked");
97
+ });
100
98
 
101
99
  /**
102
100
  * Handle action popup results for GraphQL LSP help
103
101
  */
104
- function on_graphql_lsp_action_result(data: ActionPopupResultData): void {
102
+
103
+ editor.on("action_popup_result", (data) => {
105
104
  if (data.popup_id !== "graphql-lsp-help") {
106
105
  return;
107
106
  }
@@ -132,8 +131,6 @@ function on_graphql_lsp_action_result(data: ActionPopupResultData): void {
132
131
  default:
133
132
  editor.debug(`graphql-lsp: Unknown action: ${data.action_id}`);
134
133
  }
135
- }
136
- registerHandler("on_graphql_lsp_action_result", on_graphql_lsp_action_result);
137
- editor.on("action_popup_result", "on_graphql_lsp_action_result");
134
+ });
138
135
 
139
136
  editor.debug("graphql-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let haskellLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_haskell_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "haskell") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_haskell_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`Haskell LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_haskell_lsp_server_error", on_haskell_lsp_server_error);
60
- editor.on("lsp_server_error", "on_haskell_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_haskell_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "haskell" || !haskellLspError) {
64
64
  return;
65
65
  }
@@ -78,11 +78,10 @@ function on_haskell_lsp_status_clicked(data: LspStatusClickedData): void {
78
78
  { id: "dismiss", label: "Dismiss (ESC)" },
79
79
  ],
80
80
  });
81
- }
82
- registerHandler("on_haskell_lsp_status_clicked", on_haskell_lsp_status_clicked);
83
- editor.on("lsp_status_clicked", "on_haskell_lsp_status_clicked");
81
+ });
82
+
84
83
 
85
- function on_haskell_lsp_action_result(data: ActionPopupResultData): void {
84
+ editor.on("action_popup_result", (data) => {
86
85
  if (data.popup_id !== "haskell-lsp-help") {
87
86
  return;
88
87
  }
@@ -118,8 +117,6 @@ function on_haskell_lsp_action_result(data: ActionPopupResultData): void {
118
117
  default:
119
118
  editor.debug(`haskell-lsp: Unknown action: ${data.action_id}`);
120
119
  }
121
- }
122
- registerHandler("on_haskell_lsp_action_result", on_haskell_lsp_action_result);
123
- editor.on("action_popup_result", "on_haskell_lsp_action_result");
120
+ });
124
121
 
125
122
  editor.debug("haskell-lsp: Plugin loaded");
@@ -46,9 +46,10 @@ let htmlLspError: { serverCommand: string; message: string } | null = null;
46
46
  /**
47
47
  * Handle LSP server errors for HTML
48
48
  */
49
- function on_html_lsp_server_error(
50
- data: LspServerErrorData
51
- ): void {
49
+
50
+
51
+ // Register hook for LSP server errors
52
+ editor.on("lsp_server_error", (data) => {
52
53
  // Only handle HTML language errors
53
54
  if (data.language !== "html") {
54
55
  return;
@@ -70,18 +71,15 @@ function on_html_lsp_server_error(
70
71
  } else {
71
72
  editor.setStatus(`HTML LSP error: ${data.message}`);
72
73
  }
73
- }
74
- registerHandler("on_html_lsp_server_error", on_html_lsp_server_error);
75
-
76
- // Register hook for LSP server errors
77
- editor.on("lsp_server_error", "on_html_lsp_server_error");
74
+ });
78
75
 
79
76
  /**
80
77
  * Handle status bar click when there's an HTML LSP error
81
78
  */
82
- function on_html_lsp_status_clicked(
83
- data: LspStatusClickedData
84
- ): void {
79
+
80
+
81
+ // Register hook for status bar clicks
82
+ editor.on("lsp_status_clicked", (data) => {
85
83
  // Only handle HTML language clicks when there's an error
86
84
  if (data.language !== "html" || !htmlLspError) {
87
85
  return;
@@ -100,18 +98,15 @@ function on_html_lsp_status_clicked(
100
98
  { id: "dismiss", label: "Dismiss (ESC)" },
101
99
  ],
102
100
  });
103
- }
104
- registerHandler("on_html_lsp_status_clicked", on_html_lsp_status_clicked);
105
-
106
- // Register hook for status bar clicks
107
- editor.on("lsp_status_clicked", "on_html_lsp_status_clicked");
101
+ });
108
102
 
109
103
  /**
110
104
  * Handle action popup results for HTML LSP help
111
105
  */
112
- function on_html_lsp_action_result(
113
- data: ActionPopupResultData
114
- ): void {
106
+
107
+
108
+ // Register hook for action popup results
109
+ editor.on("action_popup_result", (data) => {
115
110
  // Only handle our popup
116
111
  if (data.popup_id !== "html-lsp-help") {
117
112
  return;
@@ -139,10 +134,6 @@ function on_html_lsp_action_result(
139
134
  default:
140
135
  editor.debug(`html-lsp: Unknown action: ${data.action_id}`);
141
136
  }
142
- }
143
- registerHandler("on_html_lsp_action_result", on_html_lsp_action_result);
144
-
145
- // Register hook for action popup results
146
- editor.on("action_popup_result", "on_html_lsp_action_result");
137
+ });
147
138
 
148
139
  editor.debug("html-lsp: Plugin loaded");
@@ -22,7 +22,8 @@ interface ActionPopupResultData {
22
22
  const INSTALL_URL = "https://github.com/eclipse-jdtls/eclipse.jdt.ls#installation";
23
23
  let javaLspError: { serverCommand: string; message: string } | null = null;
24
24
 
25
- function on_java_lsp_server_error(data: LspServerErrorData) : void {
25
+
26
+ editor.on("lsp_server_error", (data) => {
26
27
  if (data.language !== "java") return;
27
28
  javaLspError = { serverCommand: data.server_command, message: data.message };
28
29
  if (data.error_type === "not_found") {
@@ -30,11 +31,10 @@ function on_java_lsp_server_error(data: LspServerErrorData) : void {
30
31
  } else {
31
32
  editor.setStatus(`Java LSP error: ${data.message}`);
32
33
  }
33
- }
34
- registerHandler("on_java_lsp_server_error", on_java_lsp_server_error);
35
- editor.on("lsp_server_error", "on_java_lsp_server_error");
34
+ });
35
+
36
36
 
37
- function on_java_lsp_status_clicked(data: LspStatusClickedData) : void {
37
+ editor.on("lsp_status_clicked", (data) => {
38
38
  if (data.language !== "java" || !javaLspError) return;
39
39
  editor.showActionPopup({
40
40
  id: "java-lsp-help",
@@ -46,11 +46,10 @@ function on_java_lsp_status_clicked(data: LspStatusClickedData) : void {
46
46
  { id: "dismiss", label: "Dismiss (ESC)" },
47
47
  ],
48
48
  });
49
- }
50
- registerHandler("on_java_lsp_status_clicked", on_java_lsp_status_clicked);
51
- editor.on("lsp_status_clicked", "on_java_lsp_status_clicked");
49
+ });
50
+
52
51
 
53
- function on_java_lsp_action_result(data: ActionPopupResultData) : void {
52
+ editor.on("action_popup_result", (data) => {
54
53
  if (data.popup_id !== "java-lsp-help") return;
55
54
  switch (data.action_id) {
56
55
  case "copy_url":
@@ -63,6 +62,4 @@ function on_java_lsp_action_result(data: ActionPopupResultData) : void {
63
62
  javaLspError = null;
64
63
  break;
65
64
  }
66
- }
67
- registerHandler("on_java_lsp_action_result", on_java_lsp_action_result);
68
- editor.on("action_popup_result", "on_java_lsp_action_result");
65
+ });
@@ -46,9 +46,10 @@ let jsonLspError: { serverCommand: string; message: string } | null = null;
46
46
  /**
47
47
  * Handle LSP server errors for JSON
48
48
  */
49
- function on_json_lsp_server_error(
50
- data: LspServerErrorData
51
- ): void {
49
+
50
+
51
+ // Register hook for LSP server errors
52
+ editor.on("lsp_server_error", (data) => {
52
53
  // Only handle JSON language errors
53
54
  if (data.language !== "json") {
54
55
  return;
@@ -70,18 +71,15 @@ function on_json_lsp_server_error(
70
71
  } else {
71
72
  editor.setStatus(`JSON LSP error: ${data.message}`);
72
73
  }
73
- }
74
- registerHandler("on_json_lsp_server_error", on_json_lsp_server_error);
75
-
76
- // Register hook for LSP server errors
77
- editor.on("lsp_server_error", "on_json_lsp_server_error");
74
+ });
78
75
 
79
76
  /**
80
77
  * Handle status bar click when there's a JSON LSP error
81
78
  */
82
- function on_json_lsp_status_clicked(
83
- data: LspStatusClickedData
84
- ): void {
79
+
80
+
81
+ // Register hook for status bar clicks
82
+ editor.on("lsp_status_clicked", (data) => {
85
83
  // Only handle JSON language clicks when there's an error
86
84
  if (data.language !== "json" || !jsonLspError) {
87
85
  return;
@@ -100,18 +98,15 @@ function on_json_lsp_status_clicked(
100
98
  { id: "dismiss", label: "Dismiss (ESC)" },
101
99
  ],
102
100
  });
103
- }
104
- registerHandler("on_json_lsp_status_clicked", on_json_lsp_status_clicked);
105
-
106
- // Register hook for status bar clicks
107
- editor.on("lsp_status_clicked", "on_json_lsp_status_clicked");
101
+ });
108
102
 
109
103
  /**
110
104
  * Handle action popup results for JSON LSP help
111
105
  */
112
- function on_json_lsp_action_result(
113
- data: ActionPopupResultData
114
- ): void {
106
+
107
+
108
+ // Register hook for action popup results
109
+ editor.on("action_popup_result", (data) => {
115
110
  // Only handle our popup
116
111
  if (data.popup_id !== "json-lsp-help") {
117
112
  return;
@@ -139,10 +134,6 @@ function on_json_lsp_action_result(
139
134
  default:
140
135
  editor.debug(`json-lsp: Unknown action: ${data.action_id}`);
141
136
  }
142
- }
143
- registerHandler("on_json_lsp_action_result", on_json_lsp_action_result);
144
-
145
- // Register hook for action popup results
146
- editor.on("action_popup_result", "on_json_lsp_action_result");
137
+ });
147
138
 
148
139
  editor.debug("json-lsp: Plugin loaded");
@@ -34,7 +34,8 @@ const INSTALL_COMMANDS = {
34
34
 
35
35
  let juliaLspError: { serverCommand: string; message: string } | null = null;
36
36
 
37
- function on_julia_lsp_server_error(data: LspServerErrorData): void {
37
+
38
+ editor.on("lsp_server_error", (data) => {
38
39
  if (data.language !== "julia") {
39
40
  return;
40
41
  }
@@ -53,11 +54,10 @@ function on_julia_lsp_server_error(data: LspServerErrorData): void {
53
54
  } else {
54
55
  editor.setStatus(`Julia LSP error: ${data.message}`);
55
56
  }
56
- }
57
- registerHandler("on_julia_lsp_server_error", on_julia_lsp_server_error);
58
- editor.on("lsp_server_error", "on_julia_lsp_server_error");
57
+ });
58
+
59
59
 
60
- function on_julia_lsp_status_clicked(data: LspStatusClickedData): void {
60
+ editor.on("lsp_status_clicked", (data) => {
61
61
  if (data.language !== "julia" || !juliaLspError) {
62
62
  return;
63
63
  }
@@ -74,11 +74,10 @@ function on_julia_lsp_status_clicked(data: LspStatusClickedData): void {
74
74
  { id: "dismiss", label: "Dismiss (ESC)" },
75
75
  ],
76
76
  });
77
- }
78
- registerHandler("on_julia_lsp_status_clicked", on_julia_lsp_status_clicked);
79
- editor.on("lsp_status_clicked", "on_julia_lsp_status_clicked");
77
+ });
78
+
80
79
 
81
- function on_julia_lsp_action_result(data: ActionPopupResultData): void {
80
+ editor.on("action_popup_result", (data) => {
82
81
  if (data.popup_id !== "julia-lsp-help") {
83
82
  return;
84
83
  }
@@ -104,8 +103,6 @@ function on_julia_lsp_action_result(data: ActionPopupResultData): void {
104
103
  default:
105
104
  editor.debug(`julia-lsp: Unknown action: ${data.action_id}`);
106
105
  }
107
- }
108
- registerHandler("on_julia_lsp_action_result", on_julia_lsp_action_result);
109
- editor.on("action_popup_result", "on_julia_lsp_action_result");
106
+ });
110
107
 
111
108
  editor.debug("julia-lsp: Plugin loaded");