@fresh-editor/fresh-editor 0.1.86 → 0.1.88

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 (39) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +4 -0
  3. package/package.json +1 -1
  4. package/plugins/README.md +1 -0
  5. package/plugins/audit_mode.ts +38 -34
  6. package/plugins/calculator.i18n.json +13 -13
  7. package/plugins/calculator.ts +6 -6
  8. package/plugins/clangd_support.i18n.json +26 -26
  9. package/plugins/config-schema.json +180 -116
  10. package/plugins/csharp_support.i18n.json +52 -52
  11. package/plugins/csharp_support.ts +214 -41
  12. package/plugins/examples/virtual_buffer_demo.ts +4 -4
  13. package/plugins/find_references.i18n.json +91 -91
  14. package/plugins/git_blame.ts +3 -3
  15. package/plugins/git_explorer.ts +3 -2
  16. package/plugins/git_log.i18n.json +182 -182
  17. package/plugins/git_log.ts +10 -10
  18. package/plugins/java-lsp.ts +65 -0
  19. package/plugins/latex-lsp.ts +65 -0
  20. package/plugins/lib/finder.ts +32 -32
  21. package/plugins/lib/fresh.d.ts +432 -17
  22. package/plugins/lib/panel-manager.ts +7 -7
  23. package/plugins/lib/search-utils.ts +13 -13
  24. package/plugins/lib/virtual-buffer-factory.ts +16 -14
  25. package/plugins/live_grep.i18n.json +39 -39
  26. package/plugins/markdown_compose.i18n.json +13 -13
  27. package/plugins/markdown_compose.ts +4 -4
  28. package/plugins/marksman-lsp.ts +65 -0
  29. package/plugins/merge_conflict.i18n.json +143 -143
  30. package/plugins/merge_conflict.ts +21 -21
  31. package/plugins/search_replace.i18n.json +143 -143
  32. package/plugins/search_replace.ts +6 -6
  33. package/plugins/templ-lsp.ts +65 -0
  34. package/plugins/theme_editor.i18n.json +3797 -3745
  35. package/plugins/theme_editor.ts +6 -5
  36. package/plugins/vi_mode.ts +2 -2
  37. package/plugins/zig-lsp.ts +65 -0
  38. package/themes/dracula.json +26 -5
  39. package/plugins/csharp-lsp.ts +0 -147
@@ -763,7 +763,7 @@ globalThis.show_git_log = async function(): Promise<void> {
763
763
  gitLogState.cachedContent = entriesToContent(entries);
764
764
 
765
765
  // Create virtual buffer in the current split (replacing current buffer)
766
- const bufferId = await editor.createVirtualBufferInExistingSplit({
766
+ const result = await editor.createVirtualBufferInExistingSplit({
767
767
  name: "*Git Log*",
768
768
  mode: "git-log",
769
769
  readOnly: true,
@@ -774,9 +774,9 @@ globalThis.show_git_log = async function(): Promise<void> {
774
774
  editingDisabled: true,
775
775
  });
776
776
 
777
- if (bufferId !== null) {
777
+ if (result !== null) {
778
778
  gitLogState.isOpen = true;
779
- gitLogState.bufferId = bufferId;
779
+ gitLogState.bufferId = result.bufferId;
780
780
 
781
781
  // Apply syntax highlighting
782
782
  applyGitLogHighlighting();
@@ -897,7 +897,7 @@ globalThis.git_log_show_commit = async function(): Promise<void> {
897
897
  commitDetailState.cachedContent = entriesToContent(entries);
898
898
 
899
899
  // Create virtual buffer in the current split (replacing git log view)
900
- const bufferId = await editor.createVirtualBufferInExistingSplit({
900
+ const result = await editor.createVirtualBufferInExistingSplit({
901
901
  name: `*Commit: ${commit.shortHash}*`,
902
902
  mode: "git-commit-detail",
903
903
  readOnly: true,
@@ -908,9 +908,9 @@ globalThis.git_log_show_commit = async function(): Promise<void> {
908
908
  editingDisabled: true,
909
909
  });
910
910
 
911
- if (bufferId !== null) {
911
+ if (result !== null) {
912
912
  commitDetailState.isOpen = true;
913
- commitDetailState.bufferId = bufferId;
913
+ commitDetailState.bufferId = result.bufferId;
914
914
  commitDetailState.splitId = gitLogState.splitId;
915
915
  commitDetailState.commit = commit;
916
916
 
@@ -1210,7 +1210,7 @@ globalThis.git_commit_detail_open_file = async function(): Promise<void> {
1210
1210
  }
1211
1211
 
1212
1212
  // Create a read-only virtual buffer with the file content
1213
- const bufferId = await editor.createVirtualBufferInExistingSplit({
1213
+ const result = await editor.createVirtualBufferInExistingSplit({
1214
1214
  name: `${file} @ ${commit.shortHash}`,
1215
1215
  mode: "git-file-view",
1216
1216
  readOnly: true,
@@ -1221,16 +1221,16 @@ globalThis.git_commit_detail_open_file = async function(): Promise<void> {
1221
1221
  editingDisabled: true,
1222
1222
  });
1223
1223
 
1224
- if (bufferId !== null) {
1224
+ if (result !== null) {
1225
1225
  // Track file view state so we can navigate back
1226
1226
  fileViewState.isOpen = true;
1227
- fileViewState.bufferId = bufferId;
1227
+ fileViewState.bufferId = result.bufferId;
1228
1228
  fileViewState.splitId = commitDetailState.splitId;
1229
1229
  fileViewState.filePath = file;
1230
1230
  fileViewState.commitHash = commit.hash;
1231
1231
 
1232
1232
  // Apply syntax highlighting based on file type
1233
- applyFileViewHighlighting(bufferId, content, file);
1233
+ applyFileViewHighlighting(result.bufferId, content, file);
1234
1234
 
1235
1235
  const targetLine = line || 1;
1236
1236
  editor.setStatus(editor.t("status.file_view_ready", { file, hash: commit.shortHash, line: String(targetLine) }));
@@ -0,0 +1,65 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+ // Provides installation help when jdtls (Java LSP) is not found
3
+ const editor = getEditor();
4
+
5
+ interface LspServerErrorData {
6
+ language: string;
7
+ server_command: string;
8
+ error_type: string;
9
+ message: string;
10
+ }
11
+
12
+ interface LspStatusClickedData {
13
+ language: string;
14
+ has_error: boolean;
15
+ }
16
+
17
+ interface ActionPopupResultData {
18
+ popup_id: string;
19
+ action_id: string;
20
+ }
21
+
22
+ const INSTALL_URL = "https://github.com/eclipse-jdtls/eclipse.jdt.ls#installation";
23
+ let javaLspError: { serverCommand: string; message: string } | null = null;
24
+
25
+ globalThis.on_java_lsp_server_error = function (data: LspServerErrorData): void {
26
+ if (data.language !== "java") return;
27
+ javaLspError = { serverCommand: data.server_command, message: data.message };
28
+ if (data.error_type === "not_found") {
29
+ editor.setStatus(`Java LSP '${data.server_command}' not found. Click status bar for help.`);
30
+ } else {
31
+ editor.setStatus(`Java LSP error: ${data.message}`);
32
+ }
33
+ };
34
+ editor.on("lsp_server_error", "on_java_lsp_server_error");
35
+
36
+ globalThis.on_java_lsp_status_clicked = function (data: LspStatusClickedData): void {
37
+ if (data.language !== "java" || !javaLspError) return;
38
+ editor.showActionPopup({
39
+ id: "java-lsp-help",
40
+ title: "Java Language Server Not Found",
41
+ message: `Install jdtls for code completion and diagnostics. Visit ${INSTALL_URL}`,
42
+ actions: [
43
+ { id: "copy_url", label: "Copy install URL" },
44
+ { id: "disable", label: "Disable Java LSP" },
45
+ { id: "dismiss", label: "Dismiss (ESC)" },
46
+ ],
47
+ });
48
+ };
49
+ editor.on("lsp_status_clicked", "on_java_lsp_status_clicked");
50
+
51
+ globalThis.on_java_lsp_action_result = function (data: ActionPopupResultData): void {
52
+ if (data.popup_id !== "java-lsp-help") return;
53
+ switch (data.action_id) {
54
+ case "copy_url":
55
+ editor.setClipboard(INSTALL_URL);
56
+ editor.setStatus("Copied: " + INSTALL_URL);
57
+ break;
58
+ case "disable":
59
+ editor.disableLspForLanguage("java");
60
+ editor.setStatus("Java LSP disabled");
61
+ javaLspError = null;
62
+ break;
63
+ }
64
+ };
65
+ editor.on("action_popup_result", "on_java_lsp_action_result");
@@ -0,0 +1,65 @@
1
+ /// <reference path="./lib/fresh.d.ts" />
2
+ // Provides installation help when texlab (LaTeX LSP) is not found
3
+ const editor = getEditor();
4
+
5
+ interface LspServerErrorData {
6
+ language: string;
7
+ server_command: string;
8
+ error_type: string;
9
+ message: string;
10
+ }
11
+
12
+ interface LspStatusClickedData {
13
+ language: string;
14
+ has_error: boolean;
15
+ }
16
+
17
+ interface ActionPopupResultData {
18
+ popup_id: string;
19
+ action_id: string;
20
+ }
21
+
22
+ const INSTALL_URL = "https://github.com/latex-lsp/texlab#installation";
23
+ let latexLspError: { serverCommand: string; message: string } | null = null;
24
+
25
+ globalThis.on_latex_lsp_server_error = function (data: LspServerErrorData): void {
26
+ if (data.language !== "latex") return;
27
+ latexLspError = { serverCommand: data.server_command, message: data.message };
28
+ if (data.error_type === "not_found") {
29
+ editor.setStatus(`LaTeX LSP '${data.server_command}' not found. Click status bar for help.`);
30
+ } else {
31
+ editor.setStatus(`LaTeX LSP error: ${data.message}`);
32
+ }
33
+ };
34
+ editor.on("lsp_server_error", "on_latex_lsp_server_error");
35
+
36
+ globalThis.on_latex_lsp_status_clicked = function (data: LspStatusClickedData): void {
37
+ if (data.language !== "latex" || !latexLspError) return;
38
+ editor.showActionPopup({
39
+ id: "latex-lsp-help",
40
+ title: "LaTeX Language Server Not Found",
41
+ message: `Install texlab for code completion and diagnostics. Visit ${INSTALL_URL}`,
42
+ actions: [
43
+ { id: "copy_url", label: "Copy install URL" },
44
+ { id: "disable", label: "Disable LaTeX LSP" },
45
+ { id: "dismiss", label: "Dismiss (ESC)" },
46
+ ],
47
+ });
48
+ };
49
+ editor.on("lsp_status_clicked", "on_latex_lsp_status_clicked");
50
+
51
+ globalThis.on_latex_lsp_action_result = function (data: ActionPopupResultData): void {
52
+ if (data.popup_id !== "latex-lsp-help") return;
53
+ switch (data.action_id) {
54
+ case "copy_url":
55
+ editor.setClipboard(INSTALL_URL);
56
+ editor.setStatus("Copied: " + INSTALL_URL);
57
+ break;
58
+ case "disable":
59
+ editor.disableLspForLanguage("latex");
60
+ editor.setStatus("LaTeX LSP disabled");
61
+ latexLspError = null;
62
+ break;
63
+ }
64
+ };
65
+ editor.on("action_popup_result", "on_latex_lsp_action_result");
@@ -61,7 +61,7 @@ export interface DisplayEntry {
61
61
  export interface SearchSource<T> {
62
62
  mode: "search";
63
63
  /** Function that returns a ProcessHandle or Promise of results */
64
- search: (query: string) => ProcessHandle | Promise<T[]>;
64
+ search: (query: string) => ProcessHandle<SpawnResult> | Promise<T[]>;
65
65
  /** Debounce delay in ms (default: 150) */
66
66
  debounceMs?: number;
67
67
  /** Minimum query length to trigger search (default: 2) */
@@ -328,7 +328,7 @@ interface PromptState<T> {
328
328
  entries: DisplayEntry[];
329
329
  lastQuery: string;
330
330
  searchVersion: number;
331
- currentSearch: ProcessHandle | null;
331
+ currentSearch: ProcessHandle<SpawnResult> | null;
332
332
  pendingKill: Promise<boolean> | null;
333
333
  originalSplitId: number | null;
334
334
  }
@@ -927,17 +927,17 @@ export class Finder<T> {
927
927
  const result = await this.editor.createVirtualBufferInSplit({
928
928
  name: "*Preview*",
929
929
  mode: this.previewModeName,
930
- read_only: true,
930
+ readOnly: true,
931
931
  entries,
932
932
  ratio: 0.5,
933
933
  direction: "vertical",
934
- panel_id: `${this.config.id}-preview`,
935
- show_line_numbers: false,
936
- editing_disabled: true,
934
+ panelId: `${this.config.id}-preview`,
935
+ showLineNumbers: false,
936
+ editingDisabled: true,
937
937
  });
938
938
 
939
- this.previewState.bufferId = result.buffer_id;
940
- this.previewState.splitId = result.split_id ?? null;
939
+ this.previewState.bufferId = result.bufferId;
940
+ this.previewState.splitId = result.splitId ?? null;
941
941
 
942
942
  // Return focus to original split
943
943
  if (this.promptState.originalSplitId !== null) {
@@ -1066,19 +1066,19 @@ export class Finder<T> {
1066
1066
  const result = await this.editor.createVirtualBufferInSplit({
1067
1067
  name: `*${this.config.id.charAt(0).toUpperCase() + this.config.id.slice(1)}*`,
1068
1068
  mode: this.modeName,
1069
- read_only: true,
1069
+ readOnly: true,
1070
1070
  entries,
1071
1071
  ratio,
1072
1072
  direction: "horizontal",
1073
- panel_id: this.config.id,
1074
- show_line_numbers: false,
1075
- show_cursors: true,
1076
- editing_disabled: true,
1073
+ panelId: this.config.id,
1074
+ showLineNumbers: false,
1075
+ showCursors: true,
1076
+ editingDisabled: true,
1077
1077
  });
1078
1078
 
1079
- if (result.buffer_id !== null) {
1080
- this.panelState.bufferId = result.buffer_id;
1081
- this.panelState.splitId = result.split_id ?? null;
1079
+ if (result.bufferId !== null) {
1080
+ this.panelState.bufferId = result.bufferId;
1081
+ this.panelState.splitId = result.splitId ?? null;
1082
1082
  this.applyPanelHighlighting();
1083
1083
 
1084
1084
  const count = this.panelState.items.length;
@@ -1343,12 +1343,12 @@ export class Finder<T> {
1343
1343
  colors.selected[0],
1344
1344
  colors.selected[1],
1345
1345
  colors.selected[2],
1346
- -1,
1347
- -1,
1348
- -1,
1349
1346
  false,
1350
- true,
1351
1347
  false,
1348
+ false,
1349
+ undefined,
1350
+ undefined,
1351
+ undefined,
1352
1352
  true
1353
1353
  );
1354
1354
  }
@@ -1363,12 +1363,12 @@ export class Finder<T> {
1363
1363
  colors.title[0],
1364
1364
  colors.title[1],
1365
1365
  colors.title[2],
1366
- -1,
1367
- -1,
1368
- -1,
1369
1366
  false,
1370
1367
  true,
1371
1368
  false,
1369
+ undefined,
1370
+ undefined,
1371
+ undefined,
1372
1372
  false
1373
1373
  );
1374
1374
  }
@@ -1383,12 +1383,12 @@ export class Finder<T> {
1383
1383
  colors.fileHeader[0],
1384
1384
  colors.fileHeader[1],
1385
1385
  colors.fileHeader[2],
1386
- -1,
1387
- -1,
1388
- -1,
1389
1386
  false,
1390
1387
  true,
1391
1388
  false,
1389
+ undefined,
1390
+ undefined,
1391
+ undefined,
1392
1392
  false
1393
1393
  );
1394
1394
  }
@@ -1423,12 +1423,12 @@ export class Finder<T> {
1423
1423
  color[0],
1424
1424
  color[1],
1425
1425
  color[2],
1426
- -1,
1427
- -1,
1428
- -1,
1429
1426
  false,
1430
1427
  true,
1431
1428
  false,
1429
+ undefined,
1430
+ undefined,
1431
+ undefined,
1432
1432
  false
1433
1433
  );
1434
1434
  }
@@ -1443,12 +1443,12 @@ export class Finder<T> {
1443
1443
  colors.help[0],
1444
1444
  colors.help[1],
1445
1445
  colors.help[2],
1446
- -1,
1447
- -1,
1448
- -1,
1449
1446
  false,
1450
1447
  false,
1451
1448
  false,
1449
+ undefined,
1450
+ undefined,
1451
+ undefined,
1452
1452
  false
1453
1453
  );
1454
1454
  }