@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.
- package/CHANGELOG.md +216 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/plugins/astro-lsp.ts +6 -12
- package/plugins/audit_mode.i18n.json +14 -14
- package/plugins/audit_mode.ts +182 -146
- 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 +79 -6
- 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 +1903 -0
- package/plugins/devcontainer.i18n.json +1472 -0
- package/plugins/devcontainer.ts +2793 -0
- 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.i18n.json +14 -42
- package/plugins/git_log.ts +19 -9
- 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 +603 -0
- package/plugins/lua-lsp.ts +15 -22
- package/plugins/markdown_compose.ts +132 -128
- 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 +126 -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 +98 -14
- package/plugins/theme_editor.ts +156 -209
- 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/themes/high-contrast.json +2 -2
- package/themes/nord.json +4 -0
- package/themes/solarized-dark.json +4 -0
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
|
|
@@ -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
|
-
|
|
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
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
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
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
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
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
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
|
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
|
+
}
|