@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
@@ -1637,11 +1637,66 @@ function findMatchingColor(input: string): string | null {
1637
1637
  /**
1638
1638
  * Handle color prompt confirmation
1639
1639
  */
1640
- function onThemeColorPromptConfirmed(args: {
1641
- prompt_type: string;
1642
- selected_index: number | null;
1643
- input: string;
1644
- }): boolean {
1640
+
1641
+
1642
+ /**
1643
+ * Handle open theme prompt (both builtin and user themes)
1644
+ */
1645
+
1646
+
1647
+ /**
1648
+ * Handle save as prompt
1649
+ */
1650
+
1651
+
1652
+ /**
1653
+ * Handle prompt cancellation
1654
+ */
1655
+
1656
+
1657
+ /**
1658
+ * Handle initial theme selection prompt (when opening editor)
1659
+ */
1660
+
1661
+
1662
+ // Register prompt handlers
1663
+ editor.on("prompt_confirmed", async (args) => {
1664
+ editor.debug(`[theme_editor] onThemeSelectInitialPromptConfirmed called with: ${JSON.stringify(args)}`);
1665
+ if (args.prompt_type !== "theme-select-initial") {
1666
+ editor.debug(`[theme_editor] prompt_type mismatch, expected 'theme-select-initial', got '${args.prompt_type}'`);
1667
+ return true;
1668
+ }
1669
+ editor.debug(`[theme_editor] prompt_type matched, processing selection...`);
1670
+
1671
+ const key = args.input.trim();
1672
+ const isBuiltin = state.builtinKeys.has(key);
1673
+ const entry = state.themeRegistry.get(key);
1674
+ const themeName = entry?.name || key;
1675
+
1676
+ editor.debug(editor.t("status.loading"));
1677
+
1678
+ const themeData = loadThemeFile(key);
1679
+ if (themeData) {
1680
+ state.themeData = deepClone(themeData);
1681
+ state.originalThemeData = deepClone(themeData);
1682
+ state.themeName = themeName;
1683
+ state.themeKey = key;
1684
+ state.themePath = null;
1685
+ state.isBuiltin = isBuiltin;
1686
+ state.hasChanges = false;
1687
+ } else {
1688
+ editor.setStatus(`Failed to load theme '${themeName}'`);
1689
+ return true;
1690
+ }
1691
+
1692
+ // Now open the editor with loaded theme
1693
+ editor.debug(`[theme_editor] About to call doOpenThemeEditor()`);
1694
+ await doOpenThemeEditor();
1695
+ editor.debug(`[theme_editor] doOpenThemeEditor() completed`);
1696
+
1697
+ return true;
1698
+ });
1699
+ editor.on("prompt_confirmed", (args) => {
1645
1700
  if (!args.prompt_type.startsWith("theme-color-")) return true;
1646
1701
 
1647
1702
  const path = args.prompt_type.replace("theme-color-", "");
@@ -1688,17 +1743,8 @@ function onThemeColorPromptConfirmed(args: {
1688
1743
  }
1689
1744
 
1690
1745
  return true;
1691
- }
1692
- registerHandler("onThemeColorPromptConfirmed", onThemeColorPromptConfirmed);
1693
-
1694
- /**
1695
- * Handle open theme prompt (both builtin and user themes)
1696
- */
1697
- async function onThemeOpenPromptConfirmed(args: {
1698
- prompt_type: string;
1699
- selected_index: number | null;
1700
- input: string;
1701
- }): Promise<boolean> {
1746
+ });
1747
+ editor.on("prompt_confirmed", (args) => {
1702
1748
  if (args.prompt_type !== "theme-open") return true;
1703
1749
 
1704
1750
  const key = args.input.trim();
@@ -1723,17 +1769,8 @@ async function onThemeOpenPromptConfirmed(args: {
1723
1769
  }
1724
1770
 
1725
1771
  return true;
1726
- }
1727
- registerHandler("onThemeOpenPromptConfirmed", onThemeOpenPromptConfirmed);
1728
-
1729
- /**
1730
- * Handle save as prompt
1731
- */
1732
- async function onThemeSaveAsPromptConfirmed(args: {
1733
- prompt_type: string;
1734
- selected_index: number | null;
1735
- input: string;
1736
- }): Promise<boolean> {
1772
+ });
1773
+ editor.on("prompt_confirmed", async (args) => {
1737
1774
  if (args.prompt_type !== "theme-save-as") return true;
1738
1775
 
1739
1776
  const name = args.input.trim();
@@ -1789,80 +1826,88 @@ async function onThemeSaveAsPromptConfirmed(args: {
1789
1826
  }
1790
1827
 
1791
1828
  return true;
1792
- }
1793
- registerHandler("onThemeSaveAsPromptConfirmed", onThemeSaveAsPromptConfirmed);
1794
-
1795
- /**
1796
- * Handle prompt cancellation
1797
- */
1798
- function onThemePromptCancelled(args: { prompt_type: string }) : boolean {
1799
- if (!args.prompt_type.startsWith("theme-")) return true;
1829
+ });
1830
+ editor.on("prompt_confirmed", (args) => {
1831
+ if (args.prompt_type !== "theme-discard-confirm") return true;
1800
1832
 
1801
- // Clear saved state on cancellation
1802
- state.savedCursorPath = null;
1803
- state.pendingSaveName = null;
1804
- state.closeAfterSave = false;
1805
- state.filterActive = false;
1833
+ const response = args.input.trim().toLowerCase();
1834
+ if (response === "discard" || args.selected_index === 2) {
1835
+ editor.setStatus(editor.t("status.unsaved_discarded"));
1836
+ doCloseEditor();
1837
+ } else if (response === "save" || args.selected_index === 1) {
1838
+ state.closeAfterSave = true;
1839
+ theme_editor_save();
1840
+ } else {
1841
+ editor.debug(editor.t("status.cancelled"));
1842
+ }
1806
1843
 
1807
- editor.debug(editor.t("status.cancelled"));
1808
- return true;
1809
- }
1810
- registerHandler("onThemePromptCancelled", onThemePromptCancelled);
1844
+ return false;
1845
+ });
1846
+ editor.on("prompt_confirmed", async (args) => {
1847
+ if (args.prompt_type !== "theme-overwrite-confirm") return true;
1811
1848
 
1812
- /**
1813
- * Handle initial theme selection prompt (when opening editor)
1814
- */
1815
- async function onThemeSelectInitialPromptConfirmed(args: {
1816
- prompt_type: string;
1817
- selected_index: number | null;
1818
- input: string;
1819
- }): Promise<boolean> {
1820
- editor.debug(`[theme_editor] onThemeSelectInitialPromptConfirmed called with: ${JSON.stringify(args)}`);
1821
- if (args.prompt_type !== "theme-select-initial") {
1822
- editor.debug(`[theme_editor] prompt_type mismatch, expected 'theme-select-initial', got '${args.prompt_type}'`);
1823
- return true;
1849
+ const response = args.input.trim().toLowerCase();
1850
+ if (response === "overwrite" || args.selected_index === 0) {
1851
+ // Use pending name if set (from Save As), otherwise use current name
1852
+ const nameToSave = state.pendingSaveName || state.themeName;
1853
+ state.themeName = nameToSave;
1854
+ state.themeData.name = nameToSave;
1855
+ state.pendingSaveName = null;
1856
+ const restorePath = state.savedCursorPath;
1857
+ state.savedCursorPath = null;
1858
+ await saveTheme(nameToSave, restorePath);
1859
+ } else {
1860
+ state.pendingSaveName = null;
1861
+ state.savedCursorPath = null;
1862
+ state.closeAfterSave = false;
1863
+ editor.debug(editor.t("status.cancelled"));
1824
1864
  }
1825
- editor.debug(`[theme_editor] prompt_type matched, processing selection...`);
1826
1865
 
1827
- const key = args.input.trim();
1828
- const isBuiltin = state.builtinKeys.has(key);
1829
- const entry = state.themeRegistry.get(key);
1830
- const themeName = entry?.name || key;
1866
+ return false;
1867
+ });
1868
+ editor.on("prompt_confirmed", async (args) => {
1869
+ if (args.prompt_type !== "theme-delete-confirm") return true;
1831
1870
 
1832
- editor.debug(editor.t("status.loading"));
1871
+ const value = args.input.trim();
1872
+ if (value === "delete" || value === editor.t("prompt.delete_yes")) {
1873
+ if (state.themeName) {
1874
+ try {
1875
+ // Delete the theme file by name
1876
+ await editor.deleteTheme(state.themeName);
1877
+ const deletedName = state.themeName;
1833
1878
 
1834
- const themeData = loadThemeFile(key);
1835
- if (themeData) {
1836
- state.themeData = deepClone(themeData);
1837
- state.originalThemeData = deepClone(themeData);
1838
- state.themeName = themeName;
1839
- state.themeKey = key;
1840
- state.themePath = null;
1841
- state.isBuiltin = isBuiltin;
1842
- state.hasChanges = false;
1879
+ // Reset to default theme
1880
+ state.themeData = createDefaultTheme();
1881
+ state.originalThemeData = deepClone(state.themeData);
1882
+ state.themeName = "";
1883
+ state.themeKey = "";
1884
+ state.themePath = null;
1885
+ state.hasChanges = false;
1886
+ updateDisplay();
1887
+
1888
+ editor.setStatus(editor.t("status.deleted", { name: deletedName }));
1889
+ } catch (e) {
1890
+ editor.setStatus(editor.t("status.delete_failed", { error: String(e) }));
1891
+ }
1892
+ }
1843
1893
  } else {
1844
- editor.setStatus(`Failed to load theme '${themeName}'`);
1845
- return true;
1894
+ editor.debug(editor.t("status.cancelled"));
1846
1895
  }
1847
1896
 
1848
- // Now open the editor with loaded theme
1849
- editor.debug(`[theme_editor] About to call doOpenThemeEditor()`);
1850
- await doOpenThemeEditor();
1851
- editor.debug(`[theme_editor] doOpenThemeEditor() completed`);
1852
-
1853
1897
  return true;
1854
- }
1855
- registerHandler("onThemeSelectInitialPromptConfirmed", onThemeSelectInitialPromptConfirmed);
1898
+ });
1899
+ editor.on("prompt_cancelled", (args) => {
1900
+ if (!args.prompt_type.startsWith("theme-")) return true;
1856
1901
 
1857
- // Register prompt handlers
1858
- editor.on("prompt_confirmed", "onThemeSelectInitialPromptConfirmed");
1859
- editor.on("prompt_confirmed", "onThemeColorPromptConfirmed");
1860
- editor.on("prompt_confirmed", "onThemeOpenPromptConfirmed");
1861
- editor.on("prompt_confirmed", "onThemeSaveAsPromptConfirmed");
1862
- editor.on("prompt_confirmed", "onThemeDiscardPromptConfirmed");
1863
- editor.on("prompt_confirmed", "onThemeOverwritePromptConfirmed");
1864
- editor.on("prompt_confirmed", "onThemeDeletePromptConfirmed");
1865
- editor.on("prompt_cancelled", "onThemePromptCancelled");
1902
+ // Clear saved state on cancellation
1903
+ state.savedCursorPath = null;
1904
+ state.pendingSaveName = null;
1905
+ state.closeAfterSave = false;
1906
+ state.filterActive = false;
1907
+
1908
+ editor.debug(editor.t("status.cancelled"));
1909
+ return true;
1910
+ });
1866
1911
 
1867
1912
  // =============================================================================
1868
1913
  // Theme Operations
@@ -1906,7 +1951,10 @@ async function saveTheme(name?: string, restorePath?: string | null): Promise<bo
1906
1951
 
1907
1952
  state.themePath = savedPath;
1908
1953
  state.themeName = themeName;
1909
- state.themeKey = `file://${savedPath}`;
1954
+ // Use the portable theme name as the key. The registry resolves names
1955
+ // via its name-fallback, and config persistence strips the absolute
1956
+ // `file://` prefix for user themes (see apply_theme in Rust).
1957
+ state.themeKey = themeName;
1910
1958
  state.isBuiltin = false; // After saving, it's now a user theme
1911
1959
  state.originalThemeData = deepClone(state.themeData);
1912
1960
  state.hasChanges = false;
@@ -2011,13 +2059,9 @@ function createDefaultTheme(): Record<string, unknown> {
2011
2059
  // Cursor Movement Handler
2012
2060
  // =============================================================================
2013
2061
 
2014
- function onThemeEditorCursorMoved(data: {
2015
- buffer_id: number;
2016
- cursor_id: number;
2017
- old_position: number;
2018
- new_position: number;
2019
- text_properties?: Array<Record<string, any>>;
2020
- }): void {
2062
+
2063
+
2064
+ editor.on("cursor_moved", (data) => {
2021
2065
  if (state.bufferId === null) return;
2022
2066
  // Accept cursor_moved events for any of the buffer group's panels
2023
2067
  // (tree, picker, footer). With buffer groups each panel is its own
@@ -2085,26 +2129,22 @@ function onThemeEditorCursorMoved(data: {
2085
2129
  }
2086
2130
 
2087
2131
  applySelectionHighlighting();
2088
- }
2089
- registerHandler("onThemeEditorCursorMoved", onThemeEditorCursorMoved);
2132
+ });
2090
2133
 
2091
- editor.on("cursor_moved", "onThemeEditorCursorMoved");
2092
2134
 
2093
- function onThemeEditorResize(data: { width: number; height: number }): void {
2135
+ editor.on("resize", (data) => {
2094
2136
  if (state.bufferId === null) return;
2095
2137
  state.viewportHeight = data.height;
2096
2138
  state.viewportWidth = data.width;
2097
2139
  updateDisplay();
2098
- }
2099
- registerHandler("onThemeEditorResize", onThemeEditorResize);
2100
- editor.on("resize", "onThemeEditorResize");
2140
+ });
2101
2141
 
2102
2142
  /**
2103
2143
  * Handle buffer_closed event to reset state when buffer is closed by any means
2104
2144
  */
2105
- function onThemeEditorBufferClosed(data: {
2106
- buffer_id: number;
2107
- }): void {
2145
+
2146
+
2147
+ editor.on("buffer_closed", (data) => {
2108
2148
  if (state.bufferId !== null && data.buffer_id === state.bufferId) {
2109
2149
  // Reset state when our buffer is closed
2110
2150
  state.bufferId = null;
@@ -2119,18 +2159,14 @@ function onThemeEditorBufferClosed(data: {
2119
2159
  state.selectedIndex = 0;
2120
2160
  state.treeScrollOffset = 0;
2121
2161
  }
2122
- }
2123
- registerHandler("onThemeEditorBufferClosed", onThemeEditorBufferClosed);
2124
-
2125
- editor.on("buffer_closed", "onThemeEditorBufferClosed");
2162
+ });
2126
2163
 
2127
2164
  /**
2128
2165
  * Handle theme_inspect_key hook: open the theme editor at a specific key
2129
2166
  */
2130
- async function onThemeInspectKey(data: {
2131
- theme_name: string;
2132
- key: string;
2133
- }): Promise<void> {
2167
+
2168
+
2169
+ editor.on("theme_inspect_key", async (data) => {
2134
2170
  // If already open, focus and navigate to the key
2135
2171
  if (isThemeEditorOpen()) {
2136
2172
  if (state.bufferId !== null) {
@@ -2175,10 +2211,7 @@ async function onThemeInspectKey(data: {
2175
2211
  // Open editor and navigate
2176
2212
  await doOpenThemeEditor();
2177
2213
  moveCursorToField(data.key);
2178
- }
2179
- registerHandler("onThemeInspectKey", onThemeInspectKey);
2180
-
2181
- editor.on("theme_inspect_key", "onThemeInspectKey");
2214
+ });
2182
2215
 
2183
2216
  // =============================================================================
2184
2217
  // Smart Navigation - Skip Non-Selectable Lines
@@ -2419,11 +2452,9 @@ registerHandler("theme_editor_filter", theme_editor_filter);
2419
2452
  /**
2420
2453
  * Handle filter prompt confirmation
2421
2454
  */
2422
- function onThemeFilterPromptConfirmed(args: {
2423
- prompt_type: string;
2424
- selected_index: number | null;
2425
- input: string;
2426
- }): boolean {
2455
+
2456
+
2457
+ editor.on("prompt_confirmed", (args) => {
2427
2458
  if (args.prompt_type !== "theme-filter") return true;
2428
2459
 
2429
2460
  state.filterText = args.input.trim();
@@ -2432,10 +2463,7 @@ function onThemeFilterPromptConfirmed(args: {
2432
2463
  state.treeScrollOffset = 0;
2433
2464
  updateDisplay();
2434
2465
  return true;
2435
- }
2436
- registerHandler("onThemeFilterPromptConfirmed", onThemeFilterPromptConfirmed);
2437
-
2438
- editor.on("prompt_confirmed", "onThemeFilterPromptConfirmed");
2466
+ });
2439
2467
 
2440
2468
  /**
2441
2469
  * Navigate picker vertically (between sections: hex, named-colors, palette)
@@ -2705,27 +2733,7 @@ function doCloseEditor(): void {
2705
2733
  /**
2706
2734
  * Handle discard confirmation prompt
2707
2735
  */
2708
- function onThemeDiscardPromptConfirmed(args: {
2709
- prompt_type: string;
2710
- selected_index: number | null;
2711
- input: string;
2712
- }): boolean {
2713
- if (args.prompt_type !== "theme-discard-confirm") return true;
2714
-
2715
- const response = args.input.trim().toLowerCase();
2716
- if (response === "discard" || args.selected_index === 2) {
2717
- editor.setStatus(editor.t("status.unsaved_discarded"));
2718
- doCloseEditor();
2719
- } else if (response === "save" || args.selected_index === 1) {
2720
- state.closeAfterSave = true;
2721
- theme_editor_save();
2722
- } else {
2723
- editor.debug(editor.t("status.cancelled"));
2724
- }
2725
2736
 
2726
- return false;
2727
- }
2728
- registerHandler("onThemeDiscardPromptConfirmed", onThemeDiscardPromptConfirmed);
2729
2737
 
2730
2738
  /**
2731
2739
  * Edit color at cursor
@@ -2839,33 +2847,7 @@ registerHandler("theme_editor_save", theme_editor_save);
2839
2847
  /**
2840
2848
  * Handle overwrite confirmation prompt
2841
2849
  */
2842
- async function onThemeOverwritePromptConfirmed(args: {
2843
- prompt_type: string;
2844
- selected_index: number | null;
2845
- input: string;
2846
- }): Promise<boolean> {
2847
- if (args.prompt_type !== "theme-overwrite-confirm") return true;
2848
2850
 
2849
- const response = args.input.trim().toLowerCase();
2850
- if (response === "overwrite" || args.selected_index === 0) {
2851
- // Use pending name if set (from Save As), otherwise use current name
2852
- const nameToSave = state.pendingSaveName || state.themeName;
2853
- state.themeName = nameToSave;
2854
- state.themeData.name = nameToSave;
2855
- state.pendingSaveName = null;
2856
- const restorePath = state.savedCursorPath;
2857
- state.savedCursorPath = null;
2858
- await saveTheme(nameToSave, restorePath);
2859
- } else {
2860
- state.pendingSaveName = null;
2861
- state.savedCursorPath = null;
2862
- state.closeAfterSave = false;
2863
- editor.debug(editor.t("status.cancelled"));
2864
- }
2865
-
2866
- return false;
2867
- }
2868
- registerHandler("onThemeOverwritePromptConfirmed", onThemeOverwritePromptConfirmed);
2869
2851
 
2870
2852
  /**
2871
2853
  * Save theme as (new name)
@@ -2943,42 +2925,7 @@ registerHandler("theme_editor_delete", theme_editor_delete);
2943
2925
  /**
2944
2926
  * Handle delete confirmation prompt
2945
2927
  */
2946
- async function onThemeDeletePromptConfirmed(args: {
2947
- prompt_type: string;
2948
- selected_index: number | null;
2949
- input: string;
2950
- }): Promise<boolean> {
2951
- if (args.prompt_type !== "theme-delete-confirm") return true;
2952
-
2953
- const value = args.input.trim();
2954
- if (value === "delete" || value === editor.t("prompt.delete_yes")) {
2955
- if (state.themeName) {
2956
- try {
2957
- // Delete the theme file by name
2958
- await editor.deleteTheme(state.themeName);
2959
- const deletedName = state.themeName;
2960
2928
 
2961
- // Reset to default theme
2962
- state.themeData = createDefaultTheme();
2963
- state.originalThemeData = deepClone(state.themeData);
2964
- state.themeName = "";
2965
- state.themeKey = "";
2966
- state.themePath = null;
2967
- state.hasChanges = false;
2968
- updateDisplay();
2969
-
2970
- editor.setStatus(editor.t("status.deleted", { name: deletedName }));
2971
- } catch (e) {
2972
- editor.setStatus(editor.t("status.delete_failed", { error: String(e) }));
2973
- }
2974
- }
2975
- } else {
2976
- editor.debug(editor.t("status.cancelled"));
2977
- }
2978
-
2979
- return true;
2980
- }
2981
- registerHandler("onThemeDeletePromptConfirmed", onThemeDeletePromptConfirmed);
2982
2929
 
2983
2930
  // =============================================================================
2984
2931
  // Command Registration
@@ -50,7 +50,10 @@ let tomlLspError: { serverCommand: string; message: string } | null = null;
50
50
  /**
51
51
  * Handle LSP server errors for TOML
52
52
  */
53
- function on_toml_lsp_server_error(data: LspServerErrorData): void {
53
+
54
+
55
+ // Register hook for LSP server errors
56
+ editor.on("lsp_server_error", (data) => {
54
57
  // Only handle TOML language errors
55
58
  if (data.language !== "toml") {
56
59
  return;
@@ -72,18 +75,15 @@ function on_toml_lsp_server_error(data: LspServerErrorData): void {
72
75
  } else {
73
76
  editor.setStatus(`TOML LSP error: ${data.message}`);
74
77
  }
75
- }
76
- registerHandler("on_toml_lsp_server_error", on_toml_lsp_server_error);
77
-
78
- // Register hook for LSP server errors
79
- editor.on("lsp_server_error", "on_toml_lsp_server_error");
78
+ });
80
79
 
81
80
  /**
82
81
  * Handle status bar click when there's a TOML LSP error
83
82
  */
84
- function on_toml_lsp_status_clicked(
85
- data: LspStatusClickedData
86
- ): void {
83
+
84
+
85
+ // Register hook for status bar clicks
86
+ editor.on("lsp_status_clicked", (data) => {
87
87
  // Only handle TOML language clicks when there's an error
88
88
  if (data.language !== "toml" || !tomlLspError) {
89
89
  return;
@@ -104,18 +104,15 @@ function on_toml_lsp_status_clicked(
104
104
  { id: "dismiss", label: "Dismiss (ESC)" },
105
105
  ],
106
106
  });
107
- }
108
- registerHandler("on_toml_lsp_status_clicked", on_toml_lsp_status_clicked);
109
-
110
- // Register hook for status bar clicks
111
- editor.on("lsp_status_clicked", "on_toml_lsp_status_clicked");
107
+ });
112
108
 
113
109
  /**
114
110
  * Handle action popup results for TOML LSP help
115
111
  */
116
- function on_toml_lsp_action_result(
117
- data: ActionPopupResultData
118
- ): void {
112
+
113
+
114
+ // Register hook for action popup results
115
+ editor.on("action_popup_result", (data) => {
119
116
  // Only handle our popup
120
117
  if (data.popup_id !== "toml-lsp-help") {
121
118
  return;
@@ -153,10 +150,6 @@ function on_toml_lsp_action_result(
153
150
  default:
154
151
  editor.debug(`toml-lsp: Unknown action: ${data.action_id}`);
155
152
  }
156
- }
157
- registerHandler("on_toml_lsp_action_result", on_toml_lsp_action_result);
158
-
159
- // Register hook for action popup results
160
- editor.on("action_popup_result", "on_toml_lsp_action_result");
153
+ });
161
154
 
162
155
  editor.debug("toml-lsp: Plugin loaded");
@@ -0,0 +1,100 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ES2020",
5
+ "moduleResolution": "bundler",
6
+ "moduleDetection": "force",
7
+ "allowImportingTsExtensions": true,
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true,
11
+ "lib": ["ES2020"],
12
+ "types": []
13
+ },
14
+ "files": [
15
+ "lib/fresh.d.ts",
16
+ "lib/finder.ts",
17
+ "lib/git_history.ts",
18
+ "lib/index.ts",
19
+ "lib/navigation-controller.ts",
20
+ "lib/panel-manager.ts",
21
+ "lib/search-utils.ts",
22
+ "lib/types.ts",
23
+ "lib/virtual-buffer-factory.ts",
24
+ "astro-lsp.ts",
25
+ "audit_mode.ts",
26
+ "bash-lsp.ts",
27
+ "clangd-lsp.ts",
28
+ "clangd_support.ts",
29
+ "clojure-lsp.ts",
30
+ "cmake-lsp.ts",
31
+ "code-tour.ts",
32
+ "csharp_support.ts",
33
+ "css-lsp.ts",
34
+ "dart-lsp.ts",
35
+ "dashboard.ts",
36
+ "devcontainer.ts",
37
+ "diagnostics_panel.ts",
38
+ "diff_nav.ts",
39
+ "elixir-lsp.ts",
40
+ "erlang-lsp.ts",
41
+ "find_references.ts",
42
+ "flash.ts",
43
+ "fsharp-lsp.ts",
44
+ "git_blame.ts",
45
+ "git_explorer.ts",
46
+ "git_find_file.ts",
47
+ "git_grep.ts",
48
+ "git_gutter.ts",
49
+ "git_log.ts",
50
+ "gleam-lsp.ts",
51
+ "go-lsp.ts",
52
+ "graphql-lsp.ts",
53
+ "haskell-lsp.ts",
54
+ "html-lsp.ts",
55
+ "java-lsp.ts",
56
+ "json-lsp.ts",
57
+ "julia-lsp.ts",
58
+ "kotlin-lsp.ts",
59
+ "latex-lsp.ts",
60
+ "live_grep.ts",
61
+ "lua-lsp.ts",
62
+ "markdown_compose.ts",
63
+ "markdown_source.ts",
64
+ "marksman-lsp.ts",
65
+ "merge_conflict.ts",
66
+ "nim-lsp.ts",
67
+ "nix-lsp.ts",
68
+ "nushell-lsp.ts",
69
+ "ocaml-lsp.ts",
70
+ "odin-lsp.ts",
71
+ "path_complete.ts",
72
+ "perl-lsp.ts",
73
+ "php-lsp.ts",
74
+ "pkg.ts",
75
+ "protobuf-lsp.ts",
76
+ "python-lsp.ts",
77
+ "r-lsp.ts",
78
+ "ruby-lsp.ts",
79
+ "rust-lsp.ts",
80
+ "scala-lsp.ts",
81
+ "search_replace.ts",
82
+ "solidity-lsp.ts",
83
+ "sql-lsp.ts",
84
+ "svelte-lsp.ts",
85
+ "swift-lsp.ts",
86
+ "tailwindcss-lsp.ts",
87
+ "templ-lsp.ts",
88
+ "terraform-lsp.ts",
89
+ "test_i18n.ts",
90
+ "theme_editor.ts",
91
+ "toml-lsp.ts",
92
+ "typescript-lsp.ts",
93
+ "typst-lsp.ts",
94
+ "vi_mode.ts",
95
+ "vue-lsp.ts",
96
+ "welcome.ts",
97
+ "yaml-lsp.ts",
98
+ "zig-lsp.ts"
99
+ ]
100
+ }