@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.
- package/CHANGELOG.md +66 -2
- package/package.json +1 -1
- package/plugins/astro-lsp.ts +6 -12
- package/plugins/audit_mode.ts +106 -113
- package/plugins/bash-lsp.ts +15 -22
- package/plugins/clangd-lsp.ts +15 -24
- package/plugins/clojure-lsp.ts +9 -12
- package/plugins/cmake-lsp.ts +9 -12
- package/plugins/code-tour.ts +15 -16
- package/plugins/config-schema.json +10 -0
- package/plugins/csharp_support.ts +25 -30
- package/plugins/css-lsp.ts +15 -22
- package/plugins/dart-lsp.ts +9 -12
- package/plugins/dashboard.ts +118 -0
- package/plugins/devcontainer.i18n.json +84 -28
- package/plugins/devcontainer.ts +897 -170
- package/plugins/diagnostics_panel.ts +10 -17
- package/plugins/elixir-lsp.ts +9 -12
- package/plugins/erlang-lsp.ts +9 -12
- package/plugins/examples/bookmarks.ts +10 -16
- package/plugins/find_references.ts +5 -9
- package/plugins/flash.ts +577 -0
- package/plugins/fsharp-lsp.ts +9 -12
- package/plugins/git_explorer.ts +16 -20
- package/plugins/git_gutter.ts +65 -79
- package/plugins/git_log.ts +8 -8
- package/plugins/gleam-lsp.ts +9 -12
- package/plugins/go-lsp.ts +15 -22
- package/plugins/graphql-lsp.ts +9 -12
- package/plugins/haskell-lsp.ts +9 -12
- package/plugins/html-lsp.ts +15 -24
- package/plugins/java-lsp.ts +9 -12
- package/plugins/json-lsp.ts +15 -24
- package/plugins/julia-lsp.ts +9 -12
- package/plugins/kotlin-lsp.ts +15 -22
- package/plugins/latex-lsp.ts +9 -12
- package/plugins/lib/fresh.d.ts +378 -0
- package/plugins/lua-lsp.ts +15 -22
- package/plugins/markdown_compose.ts +78 -122
- package/plugins/markdown_source.ts +8 -10
- package/plugins/marksman-lsp.ts +9 -12
- package/plugins/merge_conflict.ts +15 -17
- package/plugins/nim-lsp.ts +9 -12
- package/plugins/nix-lsp.ts +9 -12
- package/plugins/nushell-lsp.ts +9 -12
- package/plugins/ocaml-lsp.ts +9 -12
- package/plugins/odin-lsp.ts +15 -22
- package/plugins/path_complete.ts +5 -6
- package/plugins/perl-lsp.ts +9 -12
- package/plugins/php-lsp.ts +15 -22
- package/plugins/pkg.ts +10 -21
- package/plugins/protobuf-lsp.ts +9 -12
- package/plugins/python-lsp.ts +15 -24
- package/plugins/r-lsp.ts +9 -12
- package/plugins/ruby-lsp.ts +15 -22
- package/plugins/rust-lsp.ts +18 -28
- package/plugins/scala-lsp.ts +9 -12
- package/plugins/schemas/theme.schema.json +18 -0
- package/plugins/search_replace.ts +10 -13
- package/plugins/solidity-lsp.ts +9 -12
- package/plugins/sql-lsp.ts +9 -12
- package/plugins/svelte-lsp.ts +9 -12
- package/plugins/swift-lsp.ts +9 -12
- package/plugins/tailwindcss-lsp.ts +9 -12
- package/plugins/templ-lsp.ts +9 -12
- package/plugins/terraform-lsp.ts +9 -12
- package/plugins/theme_editor.i18n.json +70 -14
- package/plugins/theme_editor.ts +152 -208
- package/plugins/toml-lsp.ts +15 -22
- package/plugins/tsconfig.json +100 -0
- package/plugins/typescript-lsp.ts +15 -24
- package/plugins/typst-lsp.ts +15 -22
- package/plugins/vi_mode.ts +77 -290
- package/plugins/vue-lsp.ts +9 -12
- package/plugins/yaml-lsp.ts +15 -22
- package/plugins/zig-lsp.ts +9 -12
package/plugins/theme_editor.ts
CHANGED
|
@@ -1637,11 +1637,66 @@ function findMatchingColor(input: string): string | null {
|
|
|
1637
1637
|
/**
|
|
1638
1638
|
* Handle color prompt confirmation
|
|
1639
1639
|
*/
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
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
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
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
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
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
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1866
|
+
return false;
|
|
1867
|
+
});
|
|
1868
|
+
editor.on("prompt_confirmed", async (args) => {
|
|
1869
|
+
if (args.prompt_type !== "theme-delete-confirm") return true;
|
|
1831
1870
|
|
|
1832
|
-
|
|
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
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
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.
|
|
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
|
-
|
|
1898
|
+
});
|
|
1899
|
+
editor.on("prompt_cancelled", (args) => {
|
|
1900
|
+
if (!args.prompt_type.startsWith("theme-")) return true;
|
|
1856
1901
|
|
|
1857
|
-
//
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
editor.
|
|
1864
|
-
|
|
1865
|
-
|
|
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
|
|
@@ -2014,13 +2059,9 @@ function createDefaultTheme(): Record<string, unknown> {
|
|
|
2014
2059
|
// Cursor Movement Handler
|
|
2015
2060
|
// =============================================================================
|
|
2016
2061
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
old_position: number;
|
|
2021
|
-
new_position: number;
|
|
2022
|
-
text_properties?: Array<Record<string, any>>;
|
|
2023
|
-
}): void {
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
editor.on("cursor_moved", (data) => {
|
|
2024
2065
|
if (state.bufferId === null) return;
|
|
2025
2066
|
// Accept cursor_moved events for any of the buffer group's panels
|
|
2026
2067
|
// (tree, picker, footer). With buffer groups each panel is its own
|
|
@@ -2088,26 +2129,22 @@ function onThemeEditorCursorMoved(data: {
|
|
|
2088
2129
|
}
|
|
2089
2130
|
|
|
2090
2131
|
applySelectionHighlighting();
|
|
2091
|
-
}
|
|
2092
|
-
registerHandler("onThemeEditorCursorMoved", onThemeEditorCursorMoved);
|
|
2132
|
+
});
|
|
2093
2133
|
|
|
2094
|
-
editor.on("cursor_moved", "onThemeEditorCursorMoved");
|
|
2095
2134
|
|
|
2096
|
-
|
|
2135
|
+
editor.on("resize", (data) => {
|
|
2097
2136
|
if (state.bufferId === null) return;
|
|
2098
2137
|
state.viewportHeight = data.height;
|
|
2099
2138
|
state.viewportWidth = data.width;
|
|
2100
2139
|
updateDisplay();
|
|
2101
|
-
}
|
|
2102
|
-
registerHandler("onThemeEditorResize", onThemeEditorResize);
|
|
2103
|
-
editor.on("resize", "onThemeEditorResize");
|
|
2140
|
+
});
|
|
2104
2141
|
|
|
2105
2142
|
/**
|
|
2106
2143
|
* Handle buffer_closed event to reset state when buffer is closed by any means
|
|
2107
2144
|
*/
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2145
|
+
|
|
2146
|
+
|
|
2147
|
+
editor.on("buffer_closed", (data) => {
|
|
2111
2148
|
if (state.bufferId !== null && data.buffer_id === state.bufferId) {
|
|
2112
2149
|
// Reset state when our buffer is closed
|
|
2113
2150
|
state.bufferId = null;
|
|
@@ -2122,18 +2159,14 @@ function onThemeEditorBufferClosed(data: {
|
|
|
2122
2159
|
state.selectedIndex = 0;
|
|
2123
2160
|
state.treeScrollOffset = 0;
|
|
2124
2161
|
}
|
|
2125
|
-
}
|
|
2126
|
-
registerHandler("onThemeEditorBufferClosed", onThemeEditorBufferClosed);
|
|
2127
|
-
|
|
2128
|
-
editor.on("buffer_closed", "onThemeEditorBufferClosed");
|
|
2162
|
+
});
|
|
2129
2163
|
|
|
2130
2164
|
/**
|
|
2131
2165
|
* Handle theme_inspect_key hook: open the theme editor at a specific key
|
|
2132
2166
|
*/
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
}): Promise<void> {
|
|
2167
|
+
|
|
2168
|
+
|
|
2169
|
+
editor.on("theme_inspect_key", async (data) => {
|
|
2137
2170
|
// If already open, focus and navigate to the key
|
|
2138
2171
|
if (isThemeEditorOpen()) {
|
|
2139
2172
|
if (state.bufferId !== null) {
|
|
@@ -2178,10 +2211,7 @@ async function onThemeInspectKey(data: {
|
|
|
2178
2211
|
// Open editor and navigate
|
|
2179
2212
|
await doOpenThemeEditor();
|
|
2180
2213
|
moveCursorToField(data.key);
|
|
2181
|
-
}
|
|
2182
|
-
registerHandler("onThemeInspectKey", onThemeInspectKey);
|
|
2183
|
-
|
|
2184
|
-
editor.on("theme_inspect_key", "onThemeInspectKey");
|
|
2214
|
+
});
|
|
2185
2215
|
|
|
2186
2216
|
// =============================================================================
|
|
2187
2217
|
// Smart Navigation - Skip Non-Selectable Lines
|
|
@@ -2422,11 +2452,9 @@ registerHandler("theme_editor_filter", theme_editor_filter);
|
|
|
2422
2452
|
/**
|
|
2423
2453
|
* Handle filter prompt confirmation
|
|
2424
2454
|
*/
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
input: string;
|
|
2429
|
-
}): boolean {
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
editor.on("prompt_confirmed", (args) => {
|
|
2430
2458
|
if (args.prompt_type !== "theme-filter") return true;
|
|
2431
2459
|
|
|
2432
2460
|
state.filterText = args.input.trim();
|
|
@@ -2435,10 +2463,7 @@ function onThemeFilterPromptConfirmed(args: {
|
|
|
2435
2463
|
state.treeScrollOffset = 0;
|
|
2436
2464
|
updateDisplay();
|
|
2437
2465
|
return true;
|
|
2438
|
-
}
|
|
2439
|
-
registerHandler("onThemeFilterPromptConfirmed", onThemeFilterPromptConfirmed);
|
|
2440
|
-
|
|
2441
|
-
editor.on("prompt_confirmed", "onThemeFilterPromptConfirmed");
|
|
2466
|
+
});
|
|
2442
2467
|
|
|
2443
2468
|
/**
|
|
2444
2469
|
* Navigate picker vertically (between sections: hex, named-colors, palette)
|
|
@@ -2708,27 +2733,7 @@ function doCloseEditor(): void {
|
|
|
2708
2733
|
/**
|
|
2709
2734
|
* Handle discard confirmation prompt
|
|
2710
2735
|
*/
|
|
2711
|
-
function onThemeDiscardPromptConfirmed(args: {
|
|
2712
|
-
prompt_type: string;
|
|
2713
|
-
selected_index: number | null;
|
|
2714
|
-
input: string;
|
|
2715
|
-
}): boolean {
|
|
2716
|
-
if (args.prompt_type !== "theme-discard-confirm") return true;
|
|
2717
|
-
|
|
2718
|
-
const response = args.input.trim().toLowerCase();
|
|
2719
|
-
if (response === "discard" || args.selected_index === 2) {
|
|
2720
|
-
editor.setStatus(editor.t("status.unsaved_discarded"));
|
|
2721
|
-
doCloseEditor();
|
|
2722
|
-
} else if (response === "save" || args.selected_index === 1) {
|
|
2723
|
-
state.closeAfterSave = true;
|
|
2724
|
-
theme_editor_save();
|
|
2725
|
-
} else {
|
|
2726
|
-
editor.debug(editor.t("status.cancelled"));
|
|
2727
|
-
}
|
|
2728
2736
|
|
|
2729
|
-
return false;
|
|
2730
|
-
}
|
|
2731
|
-
registerHandler("onThemeDiscardPromptConfirmed", onThemeDiscardPromptConfirmed);
|
|
2732
2737
|
|
|
2733
2738
|
/**
|
|
2734
2739
|
* Edit color at cursor
|
|
@@ -2842,33 +2847,7 @@ registerHandler("theme_editor_save", theme_editor_save);
|
|
|
2842
2847
|
/**
|
|
2843
2848
|
* Handle overwrite confirmation prompt
|
|
2844
2849
|
*/
|
|
2845
|
-
async function onThemeOverwritePromptConfirmed(args: {
|
|
2846
|
-
prompt_type: string;
|
|
2847
|
-
selected_index: number | null;
|
|
2848
|
-
input: string;
|
|
2849
|
-
}): Promise<boolean> {
|
|
2850
|
-
if (args.prompt_type !== "theme-overwrite-confirm") return true;
|
|
2851
2850
|
|
|
2852
|
-
const response = args.input.trim().toLowerCase();
|
|
2853
|
-
if (response === "overwrite" || args.selected_index === 0) {
|
|
2854
|
-
// Use pending name if set (from Save As), otherwise use current name
|
|
2855
|
-
const nameToSave = state.pendingSaveName || state.themeName;
|
|
2856
|
-
state.themeName = nameToSave;
|
|
2857
|
-
state.themeData.name = nameToSave;
|
|
2858
|
-
state.pendingSaveName = null;
|
|
2859
|
-
const restorePath = state.savedCursorPath;
|
|
2860
|
-
state.savedCursorPath = null;
|
|
2861
|
-
await saveTheme(nameToSave, restorePath);
|
|
2862
|
-
} else {
|
|
2863
|
-
state.pendingSaveName = null;
|
|
2864
|
-
state.savedCursorPath = null;
|
|
2865
|
-
state.closeAfterSave = false;
|
|
2866
|
-
editor.debug(editor.t("status.cancelled"));
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
return false;
|
|
2870
|
-
}
|
|
2871
|
-
registerHandler("onThemeOverwritePromptConfirmed", onThemeOverwritePromptConfirmed);
|
|
2872
2851
|
|
|
2873
2852
|
/**
|
|
2874
2853
|
* Save theme as (new name)
|
|
@@ -2946,42 +2925,7 @@ registerHandler("theme_editor_delete", theme_editor_delete);
|
|
|
2946
2925
|
/**
|
|
2947
2926
|
* Handle delete confirmation prompt
|
|
2948
2927
|
*/
|
|
2949
|
-
async function onThemeDeletePromptConfirmed(args: {
|
|
2950
|
-
prompt_type: string;
|
|
2951
|
-
selected_index: number | null;
|
|
2952
|
-
input: string;
|
|
2953
|
-
}): Promise<boolean> {
|
|
2954
|
-
if (args.prompt_type !== "theme-delete-confirm") return true;
|
|
2955
|
-
|
|
2956
|
-
const value = args.input.trim();
|
|
2957
|
-
if (value === "delete" || value === editor.t("prompt.delete_yes")) {
|
|
2958
|
-
if (state.themeName) {
|
|
2959
|
-
try {
|
|
2960
|
-
// Delete the theme file by name
|
|
2961
|
-
await editor.deleteTheme(state.themeName);
|
|
2962
|
-
const deletedName = state.themeName;
|
|
2963
2928
|
|
|
2964
|
-
// Reset to default theme
|
|
2965
|
-
state.themeData = createDefaultTheme();
|
|
2966
|
-
state.originalThemeData = deepClone(state.themeData);
|
|
2967
|
-
state.themeName = "";
|
|
2968
|
-
state.themeKey = "";
|
|
2969
|
-
state.themePath = null;
|
|
2970
|
-
state.hasChanges = false;
|
|
2971
|
-
updateDisplay();
|
|
2972
|
-
|
|
2973
|
-
editor.setStatus(editor.t("status.deleted", { name: deletedName }));
|
|
2974
|
-
} catch (e) {
|
|
2975
|
-
editor.setStatus(editor.t("status.delete_failed", { error: String(e) }));
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
} else {
|
|
2979
|
-
editor.debug(editor.t("status.cancelled"));
|
|
2980
|
-
}
|
|
2981
|
-
|
|
2982
|
-
return true;
|
|
2983
|
-
}
|
|
2984
|
-
registerHandler("onThemeDeletePromptConfirmed", onThemeDeletePromptConfirmed);
|
|
2985
2929
|
|
|
2986
2930
|
// =============================================================================
|
|
2987
2931
|
// Command Registration
|
package/plugins/toml-lsp.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
+
}
|