@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
@@ -49,7 +49,10 @@ let luaLspError: { serverCommand: string; message: string } | null = null;
49
49
  /**
50
50
  * Handle LSP server errors for Lua
51
51
  */
52
- function on_lua_lsp_server_error(data: LspServerErrorData): void {
52
+
53
+
54
+ // Register hook for LSP server errors
55
+ editor.on("lsp_server_error", (data) => {
53
56
  // Only handle Lua language errors
54
57
  if (data.language !== "lua") {
55
58
  return;
@@ -71,18 +74,15 @@ function on_lua_lsp_server_error(data: LspServerErrorData): void {
71
74
  } else {
72
75
  editor.setStatus(`Lua LSP error: ${data.message}`);
73
76
  }
74
- }
75
- registerHandler("on_lua_lsp_server_error", on_lua_lsp_server_error);
76
-
77
- // Register hook for LSP server errors
78
- editor.on("lsp_server_error", "on_lua_lsp_server_error");
77
+ });
79
78
 
80
79
  /**
81
80
  * Handle status bar click when there's a Lua LSP error
82
81
  */
83
- function on_lua_lsp_status_clicked(
84
- data: LspStatusClickedData
85
- ): void {
82
+
83
+
84
+ // Register hook for status bar clicks
85
+ editor.on("lsp_status_clicked", (data) => {
86
86
  // Only handle Lua language clicks when there's an error
87
87
  if (data.language !== "lua" || !luaLspError) {
88
88
  return;
@@ -103,18 +103,15 @@ function on_lua_lsp_status_clicked(
103
103
  { id: "dismiss", label: "Dismiss (ESC)" },
104
104
  ],
105
105
  });
106
- }
107
- registerHandler("on_lua_lsp_status_clicked", on_lua_lsp_status_clicked);
108
-
109
- // Register hook for status bar clicks
110
- editor.on("lsp_status_clicked", "on_lua_lsp_status_clicked");
106
+ });
111
107
 
112
108
  /**
113
109
  * Handle action popup results for Lua LSP help
114
110
  */
115
- function on_lua_lsp_action_result(
116
- data: ActionPopupResultData
117
- ): void {
111
+
112
+
113
+ // Register hook for action popup results
114
+ editor.on("action_popup_result", (data) => {
118
115
  // Only handle our popup
119
116
  if (data.popup_id !== "lua-lsp-help") {
120
117
  return;
@@ -152,10 +149,6 @@ function on_lua_lsp_action_result(
152
149
  default:
153
150
  editor.debug(`lua-lsp: Unknown action: ${data.action_id}`);
154
151
  }
155
- }
156
- registerHandler("on_lua_lsp_action_result", on_lua_lsp_action_result);
157
-
158
- // Register hook for action popup results
159
- editor.on("action_popup_result", "on_lua_lsp_action_result");
152
+ });
160
153
 
161
154
  editor.debug("lua-lsp: Plugin loaded");
@@ -1610,15 +1610,40 @@ function processTableAlignment(
1610
1610
  }
1611
1611
 
1612
1612
  // lines_changed: called for newly visible or invalidated lines
1613
- function onMarkdownLinesChanged(data: {
1614
- buffer_id: number;
1615
- lines: Array<{
1616
- line_number: number;
1617
- byte_start: number;
1618
- byte_end: number;
1619
- content: string;
1620
- }>;
1621
- }): void {
1613
+
1614
+
1615
+ // after_insert: no-op for conceals/overlays.
1616
+ // The edit automatically invalidates seen_byte_ranges for affected lines,
1617
+ // causing lines_changed to fire on the next render. processLineConceals
1618
+ // handles clearing and rebuilding atomically.
1619
+ // Marker-based positions auto-adjust with buffer edits, so existing conceals
1620
+ // remain visually correct until lines_changed rebuilds them.
1621
+
1622
+
1623
+ // after_delete: no-op for conceals/overlays (same reasoning as after_insert).
1624
+
1625
+
1626
+ // cursor_moved: update cursor-aware reveal/conceal for old and new cursor lines
1627
+
1628
+
1629
+ // view_transform_request is no longer needed — soft wrapping is handled by
1630
+ // marker-based soft breaks (computed in lines_changed), and layout hints
1631
+ // are set directly via setLayoutHints. This eliminates the one-frame flicker
1632
+ // caused by the async view_transform round-trip.
1633
+
1634
+ // Handle buffer close events - clean up compose mode tracking
1635
+
1636
+
1637
+ // viewport_changed: recalculate table column widths on terminal resize
1638
+
1639
+
1640
+ // Re-enable compose mode for buffers restored from a saved session.
1641
+ // The Rust side restores ViewMode::Compose and compose_width, but the plugin
1642
+ // needs to re-apply line numbers, line wrap, and layout hints when activated.
1643
+
1644
+
1645
+ // Register hooks
1646
+ editor.on("lines_changed", (data) => {
1622
1647
  if (!isComposingInAnySplit(data.buffer_id)) return;
1623
1648
  const lineNums = data.lines.map(l => `${l.line_number}(${l.byte_start}..${l.byte_end})`).join(', ');
1624
1649
  editor.debug(`[mc] lines_changed: ${data.lines.length} lines: [${lineNums}]`);
@@ -1653,49 +1678,16 @@ function onMarkdownLinesChanged(data: {
1653
1678
  if (tableWidthsGrew) {
1654
1679
  editor.refreshLines(data.buffer_id);
1655
1680
  }
1656
- }
1657
- registerHandler("onMarkdownLinesChanged", onMarkdownLinesChanged);
1658
-
1659
- // after_insert: no-op for conceals/overlays.
1660
- // The edit automatically invalidates seen_byte_ranges for affected lines,
1661
- // causing lines_changed to fire on the next render. processLineConceals
1662
- // handles clearing and rebuilding atomically.
1663
- // Marker-based positions auto-adjust with buffer edits, so existing conceals
1664
- // remain visually correct until lines_changed rebuilds them.
1665
- function onMarkdownAfterInsert(data: {
1666
- buffer_id: number;
1667
- position: number;
1668
- text: string;
1669
- affected_start: number;
1670
- affected_end: number;
1671
- }): void {
1681
+ });
1682
+ editor.on("after_insert", (data) => {
1672
1683
  if (!isComposingInAnySplit(data.buffer_id)) return;
1673
1684
  editor.debug(`[mc] after_insert: pos=${data.position} text="${data.text.replace(/\n/g,'\\n')}" affected=${data.affected_start}..${data.affected_end}`);
1674
- }
1675
- registerHandler("onMarkdownAfterInsert", onMarkdownAfterInsert);
1676
-
1677
- // after_delete: no-op for conceals/overlays (same reasoning as after_insert).
1678
- function onMarkdownAfterDelete(data: {
1679
- buffer_id: number;
1680
- start: number;
1681
- end: number;
1682
- deleted_text: string;
1683
- affected_start: number;
1684
- deleted_len: number;
1685
- }): void {
1685
+ });
1686
+ editor.on("after_delete", (data) => {
1686
1687
  if (!isComposingInAnySplit(data.buffer_id)) return;
1687
1688
  editor.debug(`[mc] after_delete: start=${data.start} end=${data.end} deleted="${data.deleted_text.replace(/\n/g,'\\n')}" affected_start=${data.affected_start} deleted_len=${data.deleted_len}`);
1688
- }
1689
- registerHandler("onMarkdownAfterDelete", onMarkdownAfterDelete);
1690
-
1691
- // cursor_moved: update cursor-aware reveal/conceal for old and new cursor lines
1692
- function onMarkdownCursorMoved(data: {
1693
- buffer_id: number;
1694
- cursor_id: number;
1695
- old_position: number;
1696
- new_position: number;
1697
- line: number;
1698
- }): void {
1689
+ });
1690
+ editor.on("cursor_moved", (data) => {
1699
1691
  if (!isComposingInAnySplit(data.buffer_id)) return;
1700
1692
 
1701
1693
  const prevLine = editor.getViewState(data.buffer_id, "last-cursor-line") as number | undefined;
@@ -1707,28 +1699,12 @@ function onMarkdownCursorMoved(data: {
1707
1699
  // auto-expose is span-level (cursor entering/leaving an emphasis or link
1708
1700
  // span within the same line must toggle its syntax markers).
1709
1701
  editor.refreshLines(data.buffer_id);
1710
- }
1711
- registerHandler("onMarkdownCursorMoved", onMarkdownCursorMoved);
1712
-
1713
- // view_transform_request is no longer needed — soft wrapping is handled by
1714
- // marker-based soft breaks (computed in lines_changed), and layout hints
1715
- // are set directly via setLayoutHints. This eliminates the one-frame flicker
1716
- // caused by the async view_transform round-trip.
1717
-
1718
- // Handle buffer close events - clean up compose mode tracking
1719
- function onMarkdownBufferClosed(data: { buffer_id: number }) : void {
1702
+ });
1703
+ // view_transform_request hook no longer needed — wrapping is handled by soft breaks
1704
+ editor.on("buffer_closed", (data) => {
1720
1705
  // View state is cleaned up automatically when the buffer is removed from keyed_states
1721
- }
1722
- registerHandler("onMarkdownBufferClosed", onMarkdownBufferClosed);
1723
-
1724
- // viewport_changed: recalculate table column widths on terminal resize
1725
- function onMarkdownViewportChanged(data: {
1726
- split_id: number;
1727
- buffer_id: number;
1728
- top_byte: number;
1729
- width: number;
1730
- height: number;
1731
- }): void {
1706
+ });
1707
+ editor.on("viewport_changed", (data) => {
1732
1708
  if (!isComposingInAnySplit(data.buffer_id)) return;
1733
1709
  if (data.width === lastViewportWidth) return;
1734
1710
  lastViewportWidth = data.width;
@@ -1749,13 +1725,39 @@ function onMarkdownViewportChanged(data: {
1749
1725
  setTableWidths(data.buffer_id, bufWidths);
1750
1726
  }
1751
1727
  editor.refreshLines(data.buffer_id);
1752
- }
1753
- registerHandler("onMarkdownViewportChanged", onMarkdownViewportChanged);
1728
+ });
1729
+ editor.on("prompt_confirmed", (args) => {
1730
+ if (args.prompt_type !== "markdown-compose-width") return;
1754
1731
 
1755
- // Re-enable compose mode for buffers restored from a saved session.
1756
- // The Rust side restores ViewMode::Compose and compose_width, but the plugin
1757
- // needs to re-apply line numbers, line wrap, and layout hints when activated.
1758
- function onMarkdownBufferActivated(data: { buffer_id: number }) : void {
1732
+ const input = args.input.trim();
1733
+ if (input.toLowerCase() === "none") {
1734
+ config.composeWidth = null;
1735
+ editor.setStatus(editor.t("status.width_none"));
1736
+
1737
+ const bufferId = editor.getActiveBufferId();
1738
+ if (isComposing(bufferId)) {
1739
+ editor.setLayoutHints(bufferId, null, {});
1740
+ editor.refreshLines(bufferId);
1741
+ }
1742
+ return;
1743
+ }
1744
+
1745
+ const width = parseInt(input, 10);
1746
+ if (!isNaN(width) && width > 20 && width < 300) {
1747
+ config.composeWidth = width;
1748
+ editor.setStatus(editor.t("status.width_set", { width: String(width) }));
1749
+
1750
+ // Re-process active buffer if in compose mode
1751
+ const bufferId = editor.getActiveBufferId();
1752
+ if (isComposing(bufferId)) {
1753
+ editor.setLayoutHints(bufferId, null, { composeWidth: config.composeWidth ?? undefined });
1754
+ editor.refreshLines(bufferId); // Trigger soft break recomputation
1755
+ }
1756
+ } else {
1757
+ editor.setStatus(editor.t("status.invalid_width"));
1758
+ }
1759
+ });
1760
+ editor.on("buffer_activated", (data) => {
1759
1761
  const bufferId = data.buffer_id;
1760
1762
 
1761
1763
  const info = editor.getBufferInfo(bufferId);
@@ -1774,19 +1776,7 @@ function onMarkdownBufferActivated(data: { buffer_id: number }) : void {
1774
1776
  // markdown buffers that aren't already in compose mode.
1775
1777
  enableMarkdownCompose(bufferId);
1776
1778
  }
1777
- }
1778
- registerHandler("onMarkdownBufferActivated", onMarkdownBufferActivated);
1779
-
1780
- // Register hooks
1781
- editor.on("lines_changed", "onMarkdownLinesChanged");
1782
- editor.on("after_insert", "onMarkdownAfterInsert");
1783
- editor.on("after_delete", "onMarkdownAfterDelete");
1784
- editor.on("cursor_moved", "onMarkdownCursorMoved");
1785
- // view_transform_request hook no longer needed — wrapping is handled by soft breaks
1786
- editor.on("buffer_closed", "onMarkdownBufferClosed");
1787
- editor.on("viewport_changed", "onMarkdownViewportChanged");
1788
- editor.on("prompt_confirmed", "onMarkdownComposeWidthConfirmed");
1789
- editor.on("buffer_activated", "onMarkdownBufferActivated");
1779
+ });
1790
1780
 
1791
1781
  // Set compose width command - starts interactive prompt
1792
1782
  function markdownSetComposeWidth() : void {
@@ -1801,41 +1791,7 @@ function markdownSetComposeWidth() : void {
1801
1791
  registerHandler("markdownSetComposeWidth", markdownSetComposeWidth);
1802
1792
 
1803
1793
  // Handle compose width prompt confirmation
1804
- function onMarkdownComposeWidthConfirmed(args: {
1805
- prompt_type: string;
1806
- input: string;
1807
- }): void {
1808
- if (args.prompt_type !== "markdown-compose-width") return;
1809
-
1810
- const input = args.input.trim();
1811
- if (input.toLowerCase() === "none") {
1812
- config.composeWidth = null;
1813
- editor.setStatus(editor.t("status.width_none"));
1814
-
1815
- const bufferId = editor.getActiveBufferId();
1816
- if (isComposing(bufferId)) {
1817
- editor.setLayoutHints(bufferId, null, {});
1818
- editor.refreshLines(bufferId);
1819
- }
1820
- return;
1821
- }
1822
-
1823
- const width = parseInt(input, 10);
1824
- if (!isNaN(width) && width > 20 && width < 300) {
1825
- config.composeWidth = width;
1826
- editor.setStatus(editor.t("status.width_set", { width: String(width) }));
1827
1794
 
1828
- // Re-process active buffer if in compose mode
1829
- const bufferId = editor.getActiveBufferId();
1830
- if (isComposing(bufferId)) {
1831
- editor.setLayoutHints(bufferId, null, { composeWidth: config.composeWidth ?? undefined });
1832
- editor.refreshLines(bufferId); // Trigger soft break recomputation
1833
- }
1834
- } else {
1835
- editor.setStatus(editor.t("status.invalid_width"));
1836
- }
1837
- }
1838
- registerHandler("onMarkdownComposeWidthConfirmed", onMarkdownComposeWidthConfirmed);
1839
1795
 
1840
1796
  // Register commands
1841
1797
  editor.registerCommand(
@@ -343,17 +343,15 @@ function updateMarkdownMode(): void {
343
343
  }
344
344
  }
345
345
 
346
- function md_src_on_buffer_activated() : void {
347
- updateMarkdownMode();
348
- }
349
- registerHandler("md_src_on_buffer_activated", md_src_on_buffer_activated);
350
346
 
351
- function md_src_on_language_changed() : void {
352
- updateMarkdownMode();
353
- }
354
- registerHandler("md_src_on_language_changed", md_src_on_language_changed);
355
347
 
356
- editor.on("buffer_activated", "md_src_on_buffer_activated");
357
- editor.on("language_changed", "md_src_on_language_changed");
348
+
349
+
350
+ editor.on("buffer_activated", () => {
351
+ updateMarkdownMode();
352
+ });
353
+ editor.on("language_changed", () => {
354
+ updateMarkdownMode();
355
+ });
358
356
 
359
357
  editor.debug("markdown_source plugin loaded");
@@ -22,7 +22,8 @@ interface ActionPopupResultData {
22
22
  const INSTALL_URL = "https://github.com/artempyanykh/marksman#how-to-install";
23
23
  let markdownLspError: { serverCommand: string; message: string } | null = null;
24
24
 
25
- function on_markdown_lsp_server_error(data: LspServerErrorData) : void {
25
+
26
+ editor.on("lsp_server_error", (data) => {
26
27
  if (data.language !== "markdown") return;
27
28
  markdownLspError = { serverCommand: data.server_command, message: data.message };
28
29
  if (data.error_type === "not_found") {
@@ -30,11 +31,10 @@ function on_markdown_lsp_server_error(data: LspServerErrorData) : void {
30
31
  } else {
31
32
  editor.setStatus(`Markdown LSP error: ${data.message}`);
32
33
  }
33
- }
34
- registerHandler("on_markdown_lsp_server_error", on_markdown_lsp_server_error);
35
- editor.on("lsp_server_error", "on_markdown_lsp_server_error");
34
+ });
35
+
36
36
 
37
- function on_markdown_lsp_status_clicked(data: LspStatusClickedData) : void {
37
+ editor.on("lsp_status_clicked", (data) => {
38
38
  if (data.language !== "markdown" || !markdownLspError) return;
39
39
  editor.showActionPopup({
40
40
  id: "marksman-lsp-help",
@@ -46,11 +46,10 @@ function on_markdown_lsp_status_clicked(data: LspStatusClickedData) : void {
46
46
  { id: "dismiss", label: "Dismiss (ESC)" },
47
47
  ],
48
48
  });
49
- }
50
- registerHandler("on_markdown_lsp_status_clicked", on_markdown_lsp_status_clicked);
51
- editor.on("lsp_status_clicked", "on_markdown_lsp_status_clicked");
49
+ });
50
+
52
51
 
53
- function on_markdown_lsp_action_result(data: ActionPopupResultData) : void {
52
+ editor.on("action_popup_result", (data) => {
54
53
  if (data.popup_id !== "marksman-lsp-help") return;
55
54
  switch (data.action_id) {
56
55
  case "copy_url":
@@ -63,6 +62,4 @@ function on_markdown_lsp_action_result(data: ActionPopupResultData) : void {
63
62
  markdownLspError = null;
64
63
  break;
65
64
  }
66
- }
67
- registerHandler("on_markdown_lsp_action_result", on_markdown_lsp_action_result);
68
- editor.on("action_popup_result", "on_markdown_lsp_action_result");
65
+ });
@@ -1700,7 +1700,18 @@ registerHandler("merge_show_help", merge_show_help);
1700
1700
  /**
1701
1701
  * Handle buffer activation - check for conflict markers
1702
1702
  */
1703
- async function onMergeBufferActivated(data: { buffer_id: number }) : Promise<void> {
1703
+
1704
+
1705
+ /**
1706
+ * Handle file open - check for conflict markers
1707
+ */
1708
+
1709
+
1710
+ // =============================================================================
1711
+ // Hook Registration
1712
+ // =============================================================================
1713
+
1714
+ editor.on("buffer_activated", async (data) => {
1704
1715
  // Don't trigger if already in merge mode
1705
1716
  if (mergeState.isActive) return;
1706
1717
 
@@ -1724,13 +1735,8 @@ async function onMergeBufferActivated(data: { buffer_id: number }) : Promise<voi
1724
1735
  } catch (e) {
1725
1736
  // Not in git repo or other error, ignore
1726
1737
  }
1727
- }
1728
- registerHandler("onMergeBufferActivated", onMergeBufferActivated);
1729
-
1730
- /**
1731
- * Handle file open - check for conflict markers
1732
- */
1733
- async function onMergeAfterFileOpen(data: { buffer_id: number; path: string }) : Promise<void> {
1738
+ });
1739
+ editor.on("after_file_open", async (data) => {
1734
1740
  // Don't trigger if already in merge mode
1735
1741
  if (mergeState.isActive) return;
1736
1742
 
@@ -1750,15 +1756,7 @@ async function onMergeAfterFileOpen(data: { buffer_id: number; path: string }) :
1750
1756
  } catch (e) {
1751
1757
  // Not in git repo or other error, ignore
1752
1758
  }
1753
- }
1754
- registerHandler("onMergeAfterFileOpen", onMergeAfterFileOpen);
1755
-
1756
- // =============================================================================
1757
- // Hook Registration
1758
- // =============================================================================
1759
-
1760
- editor.on("buffer_activated", "onMergeBufferActivated");
1761
- editor.on("after_file_open", "onMergeAfterFileOpen");
1759
+ });
1762
1760
 
1763
1761
  // =============================================================================
1764
1762
  // Command Registration - Dynamic based on merge mode state
@@ -35,7 +35,8 @@ const INSTALL_COMMANDS = {
35
35
 
36
36
  let nimLspError: { serverCommand: string; message: string } | null = null;
37
37
 
38
- function on_nim_lsp_server_error(data: LspServerErrorData): void {
38
+
39
+ editor.on("lsp_server_error", (data) => {
39
40
  if (data.language !== "nim") {
40
41
  return;
41
42
  }
@@ -54,11 +55,10 @@ function on_nim_lsp_server_error(data: LspServerErrorData): void {
54
55
  } else {
55
56
  editor.setStatus(`Nim LSP error: ${data.message}`);
56
57
  }
57
- }
58
- registerHandler("on_nim_lsp_server_error", on_nim_lsp_server_error);
59
- editor.on("lsp_server_error", "on_nim_lsp_server_error");
58
+ });
59
+
60
60
 
61
- function on_nim_lsp_status_clicked(data: LspStatusClickedData): void {
61
+ editor.on("lsp_status_clicked", (data) => {
62
62
  if (data.language !== "nim" || !nimLspError) {
63
63
  return;
64
64
  }
@@ -76,11 +76,10 @@ function on_nim_lsp_status_clicked(data: LspStatusClickedData): void {
76
76
  { id: "dismiss", label: "Dismiss (ESC)" },
77
77
  ],
78
78
  });
79
- }
80
- registerHandler("on_nim_lsp_status_clicked", on_nim_lsp_status_clicked);
81
- editor.on("lsp_status_clicked", "on_nim_lsp_status_clicked");
79
+ });
80
+
82
81
 
83
- function on_nim_lsp_action_result(data: ActionPopupResultData): void {
82
+ editor.on("action_popup_result", (data) => {
84
83
  if (data.popup_id !== "nim-lsp-help") {
85
84
  return;
86
85
  }
@@ -111,8 +110,6 @@ function on_nim_lsp_action_result(data: ActionPopupResultData): void {
111
110
  default:
112
111
  editor.debug(`nim-lsp: Unknown action: ${data.action_id}`);
113
112
  }
114
- }
115
- registerHandler("on_nim_lsp_action_result", on_nim_lsp_action_result);
116
- editor.on("action_popup_result", "on_nim_lsp_action_result");
113
+ });
117
114
 
118
115
  editor.debug("nim-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let nixLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_nix_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "nix") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_nix_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`Nix LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_nix_lsp_server_error", on_nix_lsp_server_error);
60
- editor.on("lsp_server_error", "on_nix_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_nix_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "nix" || !nixLspError) {
64
64
  return;
65
65
  }
@@ -78,11 +78,10 @@ function on_nix_lsp_status_clicked(data: LspStatusClickedData): void {
78
78
  { id: "dismiss", label: "Dismiss (ESC)" },
79
79
  ],
80
80
  });
81
- }
82
- registerHandler("on_nix_lsp_status_clicked", on_nix_lsp_status_clicked);
83
- editor.on("lsp_status_clicked", "on_nix_lsp_status_clicked");
81
+ });
82
+
84
83
 
85
- function on_nix_lsp_action_result(data: ActionPopupResultData): void {
84
+ editor.on("action_popup_result", (data) => {
86
85
  if (data.popup_id !== "nix-lsp-help") {
87
86
  return;
88
87
  }
@@ -118,8 +117,6 @@ function on_nix_lsp_action_result(data: ActionPopupResultData): void {
118
117
  default:
119
118
  editor.debug(`nix-lsp: Unknown action: ${data.action_id}`);
120
119
  }
121
- }
122
- registerHandler("on_nix_lsp_action_result", on_nix_lsp_action_result);
123
- editor.on("action_popup_result", "on_nix_lsp_action_result");
120
+ });
124
121
 
125
122
  editor.debug("nix-lsp: Plugin loaded");
@@ -49,7 +49,8 @@ let nushellLspError: { serverCommand: string; message: string } | null = null;
49
49
  /**
50
50
  * Handle LSP server errors for Nushell
51
51
  */
52
- function on_nushell_lsp_server_error(data: LspServerErrorData): void {
52
+
53
+ editor.on("lsp_server_error", (data) => {
53
54
  if (data.language !== "nushell") {
54
55
  return;
55
56
  }
@@ -68,14 +69,13 @@ function on_nushell_lsp_server_error(data: LspServerErrorData): void {
68
69
  } else {
69
70
  editor.setStatus(`Nushell LSP error: ${data.message}`);
70
71
  }
71
- }
72
- registerHandler("on_nushell_lsp_server_error", on_nushell_lsp_server_error);
73
- editor.on("lsp_server_error", "on_nushell_lsp_server_error");
72
+ });
74
73
 
75
74
  /**
76
75
  * Handle status bar click when there's a Nushell LSP error
77
76
  */
78
- function on_nushell_lsp_status_clicked(data: LspStatusClickedData): void {
77
+
78
+ editor.on("lsp_status_clicked", (data) => {
79
79
  if (data.language !== "nushell" || !nushellLspError) {
80
80
  return;
81
81
  }
@@ -94,14 +94,13 @@ function on_nushell_lsp_status_clicked(data: LspStatusClickedData): void {
94
94
  { id: "dismiss", label: "Dismiss (ESC)" },
95
95
  ],
96
96
  });
97
- }
98
- registerHandler("on_nushell_lsp_status_clicked", on_nushell_lsp_status_clicked);
99
- editor.on("lsp_status_clicked", "on_nushell_lsp_status_clicked");
97
+ });
100
98
 
101
99
  /**
102
100
  * Handle action popup results for Nushell LSP help
103
101
  */
104
- function on_nushell_lsp_action_result(data: ActionPopupResultData): void {
102
+
103
+ editor.on("action_popup_result", (data) => {
105
104
  if (data.popup_id !== "nushell-lsp-help") {
106
105
  return;
107
106
  }
@@ -137,8 +136,6 @@ function on_nushell_lsp_action_result(data: ActionPopupResultData): void {
137
136
  default:
138
137
  editor.debug(`nushell-lsp: Unknown action: ${data.action_id}`);
139
138
  }
140
- }
141
- registerHandler("on_nushell_lsp_action_result", on_nushell_lsp_action_result);
142
- editor.on("action_popup_result", "on_nushell_lsp_action_result");
139
+ });
143
140
 
144
141
  editor.debug("nushell-lsp: Plugin loaded");
@@ -36,7 +36,8 @@ const INSTALL_COMMANDS = {
36
36
 
37
37
  let ocamlLspError: { serverCommand: string; message: string } | null = null;
38
38
 
39
- function on_ocaml_lsp_server_error(data: LspServerErrorData): void {
39
+
40
+ editor.on("lsp_server_error", (data) => {
40
41
  if (data.language !== "ocaml") {
41
42
  return;
42
43
  }
@@ -55,11 +56,10 @@ function on_ocaml_lsp_server_error(data: LspServerErrorData): void {
55
56
  } else {
56
57
  editor.setStatus(`OCaml LSP error: ${data.message}`);
57
58
  }
58
- }
59
- registerHandler("on_ocaml_lsp_server_error", on_ocaml_lsp_server_error);
60
- editor.on("lsp_server_error", "on_ocaml_lsp_server_error");
59
+ });
60
+
61
61
 
62
- function on_ocaml_lsp_status_clicked(data: LspStatusClickedData): void {
62
+ editor.on("lsp_status_clicked", (data) => {
63
63
  if (data.language !== "ocaml" || !ocamlLspError) {
64
64
  return;
65
65
  }
@@ -77,11 +77,10 @@ function on_ocaml_lsp_status_clicked(data: LspStatusClickedData): void {
77
77
  { id: "dismiss", label: "Dismiss (ESC)" },
78
78
  ],
79
79
  });
80
- }
81
- registerHandler("on_ocaml_lsp_status_clicked", on_ocaml_lsp_status_clicked);
82
- editor.on("lsp_status_clicked", "on_ocaml_lsp_status_clicked");
80
+ });
81
+
83
82
 
84
- function on_ocaml_lsp_action_result(data: ActionPopupResultData): void {
83
+ editor.on("action_popup_result", (data) => {
85
84
  if (data.popup_id !== "ocaml-lsp-help") {
86
85
  return;
87
86
  }
@@ -112,8 +111,6 @@ function on_ocaml_lsp_action_result(data: ActionPopupResultData): void {
112
111
  default:
113
112
  editor.debug(`ocaml-lsp: Unknown action: ${data.action_id}`);
114
113
  }
115
- }
116
- registerHandler("on_ocaml_lsp_action_result", on_ocaml_lsp_action_result);
117
- editor.on("action_popup_result", "on_ocaml_lsp_action_result");
114
+ });
118
115
 
119
116
  editor.debug("ocaml-lsp: Plugin loaded");