@fresh-editor/fresh-editor 0.1.65 → 0.1.69

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 (64) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +4 -2
  3. package/package.json +1 -1
  4. package/plugins/audit_mode.i18n.json +380 -0
  5. package/plugins/audit_mode.ts +1813 -0
  6. package/plugins/buffer_modified.i18n.json +32 -0
  7. package/plugins/buffer_modified.ts +5 -3
  8. package/plugins/calculator.i18n.json +44 -0
  9. package/plugins/calculator.ts +6 -4
  10. package/plugins/clangd-lsp.ts +168 -0
  11. package/plugins/clangd_support.i18n.json +104 -0
  12. package/plugins/clangd_support.ts +18 -16
  13. package/plugins/color_highlighter.i18n.json +68 -0
  14. package/plugins/color_highlighter.ts +12 -10
  15. package/plugins/config-schema.json +79 -141
  16. package/plugins/csharp-lsp.ts +147 -0
  17. package/plugins/csharp_support.i18n.json +38 -0
  18. package/plugins/csharp_support.ts +6 -4
  19. package/plugins/css-lsp.ts +143 -0
  20. package/plugins/diagnostics_panel.i18n.json +110 -0
  21. package/plugins/diagnostics_panel.ts +19 -17
  22. package/plugins/find_references.i18n.json +128 -0
  23. package/plugins/find_references.ts +22 -20
  24. package/plugins/git_blame.i18n.json +230 -0
  25. package/plugins/git_blame.ts +39 -37
  26. package/plugins/git_find_file.i18n.json +146 -0
  27. package/plugins/git_find_file.ts +24 -22
  28. package/plugins/git_grep.i18n.json +80 -0
  29. package/plugins/git_grep.ts +15 -13
  30. package/plugins/git_gutter.i18n.json +44 -0
  31. package/plugins/git_gutter.ts +7 -5
  32. package/plugins/git_log.i18n.json +224 -0
  33. package/plugins/git_log.ts +41 -39
  34. package/plugins/go-lsp.ts +143 -0
  35. package/plugins/html-lsp.ts +145 -0
  36. package/plugins/json-lsp.ts +145 -0
  37. package/plugins/lib/fresh.d.ts +150 -14
  38. package/plugins/lib/index.ts +1 -1
  39. package/plugins/lib/navigation-controller.ts +3 -3
  40. package/plugins/lib/panel-manager.ts +15 -13
  41. package/plugins/lib/virtual-buffer-factory.ts +84 -112
  42. package/plugins/live_grep.i18n.json +80 -0
  43. package/plugins/live_grep.ts +15 -13
  44. package/plugins/markdown_compose.i18n.json +104 -0
  45. package/plugins/markdown_compose.ts +17 -15
  46. package/plugins/merge_conflict.i18n.json +380 -0
  47. package/plugins/merge_conflict.ts +72 -73
  48. package/plugins/path_complete.i18n.json +38 -0
  49. package/plugins/path_complete.ts +6 -4
  50. package/plugins/python-lsp.ts +162 -0
  51. package/plugins/rust-lsp.ts +166 -0
  52. package/plugins/search_replace.i18n.json +188 -0
  53. package/plugins/search_replace.ts +31 -29
  54. package/plugins/test_i18n.i18n.json +12 -0
  55. package/plugins/test_i18n.ts +18 -0
  56. package/plugins/theme_editor.i18n.json +1417 -0
  57. package/plugins/theme_editor.ts +73 -69
  58. package/plugins/todo_highlighter.i18n.json +86 -0
  59. package/plugins/todo_highlighter.ts +15 -13
  60. package/plugins/typescript-lsp.ts +167 -0
  61. package/plugins/vi_mode.i18n.json +716 -0
  62. package/plugins/vi_mode.ts +2747 -0
  63. package/plugins/welcome.i18n.json +110 -0
  64. package/plugins/welcome.ts +18 -16
@@ -0,0 +1,110 @@
1
+ {
2
+ "en": {
3
+ "cmd.show_diagnostics_panel": "Show Diagnostics Panel",
4
+ "cmd.show_diagnostics_panel_desc": "Open the diagnostics panel",
5
+ "cmd.toggle_diagnostics_panel": "Toggle Diagnostics Panel",
6
+ "cmd.toggle_diagnostics_panel_desc": "Toggle the diagnostics panel",
7
+ "status.loaded": "Diagnostics Panel plugin loaded",
8
+ "status.failed_to_open": "Failed to open diagnostics panel",
9
+ "status.closed": "Diagnostics panel closed",
10
+ "status.jumped_to": "Jumped to {file}:{line}",
11
+ "status.move_to_diagnostic": "Move cursor to a diagnostic line",
12
+ "status.showing": "Showing: {label}",
13
+ "status.refreshed": "Diagnostics refreshed",
14
+ "status.diagnostics_count": "Diagnostics: {count} items | a: toggle filter | RET: goto | q: close",
15
+ "panel.header": "Diagnostics ({filter}):",
16
+ "panel.no_diagnostics": "No diagnostics",
17
+ "panel.all_files": "All Files",
18
+ "panel.current_file": "Current File"
19
+ },
20
+ "es": {
21
+ "cmd.show_diagnostics_panel": "Mostrar Panel de Diagnosticos",
22
+ "cmd.show_diagnostics_panel_desc": "Abrir el panel de diagnosticos",
23
+ "cmd.toggle_diagnostics_panel": "Alternar Panel de Diagnosticos",
24
+ "cmd.toggle_diagnostics_panel_desc": "Alternar el panel de diagnosticos",
25
+ "status.loaded": "Plugin de Panel de Diagnosticos cargado",
26
+ "status.failed_to_open": "Error al abrir el panel de diagnosticos",
27
+ "status.closed": "Panel de diagnosticos cerrado",
28
+ "status.jumped_to": "Salto a {file}:{line}",
29
+ "status.move_to_diagnostic": "Mueve el cursor a una linea de diagnostico",
30
+ "status.showing": "Mostrando: {label}",
31
+ "status.refreshed": "Diagnosticos actualizados",
32
+ "status.diagnostics_count": "Diagnosticos: {count} elementos | a: alternar filtro | RET: ir | q: cerrar",
33
+ "panel.header": "Diagnosticos ({filter}):",
34
+ "panel.no_diagnostics": "Sin diagnosticos",
35
+ "panel.all_files": "Todos los Archivos",
36
+ "panel.current_file": "Archivo Actual"
37
+ },
38
+ "de": {
39
+ "cmd.show_diagnostics_panel": "Diagnose-Panel anzeigen",
40
+ "cmd.show_diagnostics_panel_desc": "Das Diagnose-Panel offnen",
41
+ "cmd.toggle_diagnostics_panel": "Diagnose-Panel umschalten",
42
+ "cmd.toggle_diagnostics_panel_desc": "Das Diagnose-Panel umschalten",
43
+ "status.loaded": "Diagnose-Panel Plugin geladen",
44
+ "status.failed_to_open": "Diagnose-Panel konnte nicht geoffnet werden",
45
+ "status.closed": "Diagnose-Panel geschlossen",
46
+ "status.jumped_to": "Gesprungen zu {file}:{line}",
47
+ "status.move_to_diagnostic": "Cursor zu einer Diagnosezeile bewegen",
48
+ "status.showing": "Anzeige: {label}",
49
+ "status.refreshed": "Diagnosen aktualisiert",
50
+ "status.diagnostics_count": "Diagnosen: {count} Elemente | a: Filter umschalten | RET: gehe zu | q: schliessen",
51
+ "panel.header": "Diagnosen ({filter}):",
52
+ "panel.no_diagnostics": "Keine Diagnosen",
53
+ "panel.all_files": "Alle Dateien",
54
+ "panel.current_file": "Aktuelle Datei"
55
+ },
56
+ "fr": {
57
+ "cmd.show_diagnostics_panel": "Afficher le Panneau de Diagnostics",
58
+ "cmd.show_diagnostics_panel_desc": "Ouvrir le panneau de diagnostics",
59
+ "cmd.toggle_diagnostics_panel": "Basculer le Panneau de Diagnostics",
60
+ "cmd.toggle_diagnostics_panel_desc": "Basculer le panneau de diagnostics",
61
+ "status.loaded": "Plugin du Panneau de Diagnostics charge",
62
+ "status.failed_to_open": "Echec de l'ouverture du panneau de diagnostics",
63
+ "status.closed": "Panneau de diagnostics ferme",
64
+ "status.jumped_to": "Saute vers {file}:{line}",
65
+ "status.move_to_diagnostic": "Deplacez le curseur vers une ligne de diagnostic",
66
+ "status.showing": "Affichage: {label}",
67
+ "status.refreshed": "Diagnostics actualises",
68
+ "status.diagnostics_count": "Diagnostics: {count} elements | a: basculer filtre | RET: aller | q: fermer",
69
+ "panel.header": "Diagnostics ({filter}):",
70
+ "panel.no_diagnostics": "Aucun diagnostic",
71
+ "panel.all_files": "Tous les Fichiers",
72
+ "panel.current_file": "Fichier Actuel"
73
+ },
74
+ "ja": {
75
+ "cmd.show_diagnostics_panel": "診断パネルを表示",
76
+ "cmd.show_diagnostics_panel_desc": "診断パネルを開く",
77
+ "cmd.toggle_diagnostics_panel": "診断パネルを切り替え",
78
+ "cmd.toggle_diagnostics_panel_desc": "診断パネルの表示を切り替える",
79
+ "status.loaded": "診断パネルプラグインが読み込まれました",
80
+ "status.failed_to_open": "診断パネルを開けませんでした",
81
+ "status.closed": "診断パネルを閉じました",
82
+ "status.jumped_to": "{file}:{line} にジャンプしました",
83
+ "status.move_to_diagnostic": "診断行にカーソルを移動してください",
84
+ "status.showing": "表示中: {label}",
85
+ "status.refreshed": "診断が更新されました",
86
+ "status.diagnostics_count": "診断: {count} 件 | a: フィルター切替 | RET: 移動 | q: 閉じる",
87
+ "panel.header": "診断 ({filter}):",
88
+ "panel.no_diagnostics": "診断なし",
89
+ "panel.all_files": "全てのファイル",
90
+ "panel.current_file": "現在のファイル"
91
+ },
92
+ "zh": {
93
+ "cmd.show_diagnostics_panel": "显示诊断面板",
94
+ "cmd.show_diagnostics_panel_desc": "打开诊断面板",
95
+ "cmd.toggle_diagnostics_panel": "切换诊断面板",
96
+ "cmd.toggle_diagnostics_panel_desc": "切换诊断面板显示",
97
+ "status.loaded": "诊断面板插件已加载",
98
+ "status.failed_to_open": "无法打开诊断面板",
99
+ "status.closed": "诊断面板已关闭",
100
+ "status.jumped_to": "跳转到 {file}:{line}",
101
+ "status.move_to_diagnostic": "请将光标移动到诊断行",
102
+ "status.showing": "显示: {label}",
103
+ "status.refreshed": "诊断已刷新",
104
+ "status.diagnostics_count": "诊断: {count} 项 | a: 切换过滤 | RET: 跳转 | q: 关闭",
105
+ "panel.header": "诊断 ({filter}):",
106
+ "panel.no_diagnostics": "无诊断信息",
107
+ "panel.all_files": "所有文件",
108
+ "panel.current_file": "当前文件"
109
+ }
110
+ }
@@ -1,4 +1,6 @@
1
1
  /// <reference path="./lib/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
2
4
 
3
5
  /**
4
6
  * Diagnostics Panel Plugin
@@ -185,15 +187,15 @@ function buildPanelEntries(): TextPropertyEntry[] {
185
187
  // Header (line 2)
186
188
  let filterLabel: string;
187
189
  if (state.showAllFiles) {
188
- filterLabel = "All Files";
190
+ filterLabel = editor.t("panel.all_files");
189
191
  } else if (activeUri) {
190
192
  const fileName = editor.pathBasename(uriToPath(activeUri));
191
193
  filterLabel = fileName;
192
194
  } else {
193
- filterLabel = "Current File";
195
+ filterLabel = editor.t("panel.current_file");
194
196
  }
195
197
  entries.push({
196
- text: `Diagnostics (${filterLabel}):\n`,
198
+ text: editor.t("panel.header", { filter: filterLabel }) + "\n",
197
199
  properties: { type: "header" },
198
200
  });
199
201
 
@@ -201,7 +203,7 @@ function buildPanelEntries(): TextPropertyEntry[] {
201
203
 
202
204
  if (filtered.length === 0) {
203
205
  entries.push({
204
- text: " No diagnostics\n",
206
+ text: " " + editor.t("panel.no_diagnostics") + "\n",
205
207
  properties: { type: "empty" },
206
208
  });
207
209
  currentPanelLine++;
@@ -424,11 +426,11 @@ globalThis.show_diagnostics_panel = async function(): Promise<void> {
424
426
  applyHighlighting();
425
427
 
426
428
  const diagnostics = editor.getAllDiagnostics();
427
- editor.setStatus(`Diagnostics: ${diagnostics.length} items | a: toggle filter | RET: goto | q: close`);
429
+ editor.setStatus(editor.t("status.diagnostics_count", { count: String(diagnostics.length) }));
428
430
  } else {
429
431
  state.sourceSplitId = null;
430
432
  state.sourceBufferId = null;
431
- editor.setStatus("Failed to open diagnostics panel");
433
+ editor.setStatus(editor.t("status.failed_to_open"));
432
434
  }
433
435
  };
434
436
 
@@ -470,7 +472,7 @@ globalThis.diagnostics_close = function(): void {
470
472
  editor.focusSplit(sourceSplitId);
471
473
  }
472
474
 
473
- editor.setStatus("Diagnostics panel closed");
475
+ editor.setStatus(editor.t("status.closed"));
474
476
  };
475
477
 
476
478
  globalThis.diagnostics_goto = function(): void {
@@ -490,12 +492,12 @@ globalThis.diagnostics_goto = function(): void {
490
492
  editor.focusSplit(state.sourceSplitId);
491
493
  }
492
494
  editor.openFile(file, line, col);
493
- editor.setStatus(`Jumped to ${editor.pathBasename(file)}:${line}`);
495
+ editor.setStatus(editor.t("status.jumped_to", { file: editor.pathBasename(file), line: String(line) }));
494
496
  return;
495
497
  }
496
498
  }
497
499
 
498
- editor.setStatus("Move cursor to a diagnostic line");
500
+ editor.setStatus(editor.t("status.move_to_diagnostic"));
499
501
  };
500
502
 
501
503
  globalThis.diagnostics_toggle_all = function(): void {
@@ -504,15 +506,15 @@ globalThis.diagnostics_toggle_all = function(): void {
504
506
  state.showAllFiles = !state.showAllFiles;
505
507
  updatePanel();
506
508
 
507
- const label = state.showAllFiles ? "All Files" : "Current File";
508
- editor.setStatus(`Showing: ${label}`);
509
+ const label = state.showAllFiles ? editor.t("panel.all_files") : editor.t("panel.current_file");
510
+ editor.setStatus(editor.t("status.showing", { label }));
509
511
  };
510
512
 
511
513
  globalThis.diagnostics_refresh = function(): void {
512
514
  if (!state.isOpen) return;
513
515
 
514
516
  updatePanel();
515
- editor.setStatus("Diagnostics refreshed");
517
+ editor.setStatus(editor.t("status.refreshed"));
516
518
  };
517
519
 
518
520
  globalThis.toggle_diagnostics_panel = function(): void {
@@ -619,15 +621,15 @@ editor.on("buffer_activated", "on_diagnostics_buffer_activated");
619
621
  // =============================================================================
620
622
 
621
623
  editor.registerCommand(
622
- "Show Diagnostics Panel",
623
- "Open the diagnostics panel",
624
+ "%cmd.show_diagnostics_panel",
625
+ "%cmd.show_diagnostics_panel_desc",
624
626
  "show_diagnostics_panel",
625
627
  "normal"
626
628
  );
627
629
 
628
630
  editor.registerCommand(
629
- "Toggle Diagnostics Panel",
630
- "Toggle the diagnostics panel",
631
+ "%cmd.toggle_diagnostics_panel",
632
+ "%cmd.toggle_diagnostics_panel_desc",
631
633
  "toggle_diagnostics_panel",
632
634
  "normal"
633
635
  );
@@ -636,5 +638,5 @@ editor.registerCommand(
636
638
  // Initialization
637
639
  // =============================================================================
638
640
 
639
- editor.setStatus("Diagnostics Panel plugin loaded");
641
+ editor.setStatus(editor.t("status.loaded"));
640
642
  editor.debug("Diagnostics Panel plugin initialized");
@@ -0,0 +1,128 @@
1
+ {
2
+ "en": {
3
+ "cmd.show_references": "Show References Panel",
4
+ "cmd.show_references_desc": "Display current references",
5
+ "cmd.hide_references": "Hide References Panel",
6
+ "cmd.hide_references_desc": "Close the references panel",
7
+ "status.ready": "Find References plugin loaded",
8
+ "status.no_references": "No references found for '{symbol}'",
9
+ "status.found_references": "Found {count} reference(s){limit} - Up/Down navigate, RET jump, q close",
10
+ "status.showing_first": " (showing first {max})",
11
+ "status.reference_index": "Reference {current}/{total}",
12
+ "status.jumped_to": "Jumped to {file}:{line}",
13
+ "status.no_references_to_jump": "No references to jump to",
14
+ "status.source_split_unavailable": "Source split not available",
15
+ "status.move_cursor": "Move cursor to a reference line",
16
+ "status.closed": "References panel closed",
17
+ "status.failed_open_panel": "Failed to open references panel",
18
+ "panel.header": "References to {symbol} ({count}{limit})",
19
+ "panel.limited": ", limited to {max}",
20
+ "panel.no_references": "No references found",
21
+ "panel.help": "[Up/Down] navigate [RET] jump [q/Esc] close"
22
+ },
23
+ "es": {
24
+ "cmd.show_references": "Mostrar Panel de Referencias",
25
+ "cmd.show_references_desc": "Mostrar las referencias actuales",
26
+ "cmd.hide_references": "Ocultar Panel de Referencias",
27
+ "cmd.hide_references_desc": "Cerrar el panel de referencias",
28
+ "status.ready": "Plugin Buscar Referencias cargado",
29
+ "status.no_references": "No se encontraron referencias para '{symbol}'",
30
+ "status.found_references": "Se encontraron {count} referencia(s){limit} - Arriba/Abajo navegar, RET saltar, q cerrar",
31
+ "status.showing_first": " (mostrando primeros {max})",
32
+ "status.reference_index": "Referencia {current}/{total}",
33
+ "status.jumped_to": "Saltó a {file}:{line}",
34
+ "status.no_references_to_jump": "No hay referencias a las que saltar",
35
+ "status.source_split_unavailable": "División de origen no disponible",
36
+ "status.move_cursor": "Mueve el cursor a una línea de referencia",
37
+ "status.closed": "Panel de referencias cerrado",
38
+ "status.failed_open_panel": "Error al abrir el panel de referencias",
39
+ "panel.header": "Referencias a {symbol} ({count}{limit})",
40
+ "panel.limited": ", limitado a {max}",
41
+ "panel.no_references": "No se encontraron referencias",
42
+ "panel.help": "[Arriba/Abajo] navegar [RET] saltar [q/Esc] cerrar"
43
+ },
44
+ "de": {
45
+ "cmd.show_references": "Referenzen-Panel anzeigen",
46
+ "cmd.show_references_desc": "Aktuelle Referenzen anzeigen",
47
+ "cmd.hide_references": "Referenzen-Panel ausblenden",
48
+ "cmd.hide_references_desc": "Das Referenzen-Panel schließen",
49
+ "status.ready": "Referenzen-Plugin geladen",
50
+ "status.no_references": "Keine Referenzen für '{symbol}' gefunden",
51
+ "status.found_references": "{count} Referenz(en) gefunden{limit} - Auf/Ab navigieren, RET springen, q schließen",
52
+ "status.showing_first": " (zeige erste {max})",
53
+ "status.reference_index": "Referenz {current}/{total}",
54
+ "status.jumped_to": "Gesprungen zu {file}:{line}",
55
+ "status.no_references_to_jump": "Keine Referenzen zum Springen",
56
+ "status.source_split_unavailable": "Quell-Split nicht verfügbar",
57
+ "status.move_cursor": "Cursor auf eine Referenzzeile bewegen",
58
+ "status.closed": "Referenzen-Panel geschlossen",
59
+ "status.failed_open_panel": "Fehler beim Öffnen des Referenzen-Panels",
60
+ "panel.header": "Referenzen zu {symbol} ({count}{limit})",
61
+ "panel.limited": ", begrenzt auf {max}",
62
+ "panel.no_references": "Keine Referenzen gefunden",
63
+ "panel.help": "[Auf/Ab] navigieren [RET] springen [q/Esc] schließen"
64
+ },
65
+ "fr": {
66
+ "cmd.show_references": "Afficher le panneau des références",
67
+ "cmd.show_references_desc": "Afficher les références actuelles",
68
+ "cmd.hide_references": "Masquer le panneau des références",
69
+ "cmd.hide_references_desc": "Fermer le panneau des références",
70
+ "status.ready": "Plugin Trouver les Références chargé",
71
+ "status.no_references": "Aucune référence trouvée pour '{symbol}'",
72
+ "status.found_references": "{count} référence(s) trouvée(s){limit} - Haut/Bas naviguer, RET sauter, q fermer",
73
+ "status.showing_first": " (affichage des {max} premiers)",
74
+ "status.reference_index": "Référence {current}/{total}",
75
+ "status.jumped_to": "Sauté à {file}:{line}",
76
+ "status.no_references_to_jump": "Aucune référence vers laquelle sauter",
77
+ "status.source_split_unavailable": "Panneau source non disponible",
78
+ "status.move_cursor": "Déplacez le curseur sur une ligne de référence",
79
+ "status.closed": "Panneau des références fermé",
80
+ "status.failed_open_panel": "Échec de l'ouverture du panneau des références",
81
+ "panel.header": "Références à {symbol} ({count}{limit})",
82
+ "panel.limited": ", limité à {max}",
83
+ "panel.no_references": "Aucune référence trouvée",
84
+ "panel.help": "[Haut/Bas] naviguer [RET] sauter [q/Esc] fermer"
85
+ },
86
+ "ja": {
87
+ "cmd.show_references": "参照パネルを表示",
88
+ "cmd.show_references_desc": "現在の参照を表示",
89
+ "cmd.hide_references": "参照パネルを非表示",
90
+ "cmd.hide_references_desc": "参照パネルを閉じる",
91
+ "status.ready": "参照検索プラグインが読み込まれました",
92
+ "status.no_references": "'{symbol}' の参照が見つかりません",
93
+ "status.found_references": "{count} 件の参照が見つかりました{limit} - 上/下で移動、RETでジャンプ、qで閉じる",
94
+ "status.showing_first": " (最初の {max} 件を表示)",
95
+ "status.reference_index": "参照 {current}/{total}",
96
+ "status.jumped_to": "{file}:{line} にジャンプしました",
97
+ "status.no_references_to_jump": "ジャンプする参照がありません",
98
+ "status.source_split_unavailable": "ソース分割が利用できません",
99
+ "status.move_cursor": "カーソルを参照行に移動してください",
100
+ "status.closed": "参照パネルを閉じました",
101
+ "status.failed_open_panel": "参照パネルを開けませんでした",
102
+ "panel.header": "{symbol} への参照 ({count}{limit})",
103
+ "panel.limited": "、最大 {max} 件",
104
+ "panel.no_references": "参照が見つかりません",
105
+ "panel.help": "[上/下] 移動 [RET] ジャンプ [q/Esc] 閉じる"
106
+ },
107
+ "zh": {
108
+ "cmd.show_references": "显示引用面板",
109
+ "cmd.show_references_desc": "显示当前引用",
110
+ "cmd.hide_references": "隐藏引用面板",
111
+ "cmd.hide_references_desc": "关闭引用面板",
112
+ "status.ready": "查找引用插件已加载",
113
+ "status.no_references": "未找到 '{symbol}' 的引用",
114
+ "status.found_references": "找到 {count} 个引用{limit} - 上/下导航,回车跳转,q 关闭",
115
+ "status.showing_first": " (显示前 {max} 个)",
116
+ "status.reference_index": "引用 {current}/{total}",
117
+ "status.jumped_to": "跳转到 {file}:{line}",
118
+ "status.no_references_to_jump": "没有可跳转的引用",
119
+ "status.source_split_unavailable": "源分割不可用",
120
+ "status.move_cursor": "将光标移动到引用行",
121
+ "status.closed": "引用面板已关闭",
122
+ "status.failed_open_panel": "无法打开引用面板",
123
+ "panel.header": "{symbol} 的引用 ({count}{limit})",
124
+ "panel.limited": ",限制为 {max}",
125
+ "panel.no_references": "未找到引用",
126
+ "panel.help": "[上/下] 导航 [回车] 跳转 [q/Esc] 关闭"
127
+ }
128
+ }
@@ -1,4 +1,6 @@
1
1
  /// <reference path="../types/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
2
4
 
3
5
  /**
4
6
  * Find References Plugin (TypeScript)
@@ -78,16 +80,16 @@ function buildPanelEntries(): TextPropertyEntry[] {
78
80
 
79
81
  // Header with symbol name
80
82
  const totalCount = currentReferences.length;
81
- const limitNote = totalCount >= MAX_RESULTS ? ` (limited to ${MAX_RESULTS})` : "";
83
+ const limitNote = totalCount >= MAX_RESULTS ? editor.t("panel.limited", { max: String(MAX_RESULTS) }) : "";
82
84
  const symbolDisplay = currentSymbol ? `'${currentSymbol}'` : "symbol";
83
85
  entries.push({
84
- text: `═══ References to ${symbolDisplay} (${totalCount}${limitNote}) ═══\n`,
86
+ text: `═══ ${editor.t("panel.header", { symbol: symbolDisplay, count: String(totalCount), limit: limitNote })} ═══\n`,
85
87
  properties: { type: "header" },
86
88
  });
87
89
 
88
90
  if (currentReferences.length === 0) {
89
91
  entries.push({
90
- text: " No references found\n",
92
+ text: " " + editor.t("panel.no_references") + "\n",
91
93
  properties: { type: "empty" },
92
94
  });
93
95
  } else {
@@ -115,7 +117,7 @@ function buildPanelEntries(): TextPropertyEntry[] {
115
117
  properties: { type: "separator" },
116
118
  });
117
119
  entries.push({
118
- text: `[↑/↓] navigate [RET] jump [q/Esc] close\n`,
120
+ text: editor.t("panel.help") + "\n",
119
121
  properties: { type: "help" },
120
122
  });
121
123
 
@@ -202,15 +204,15 @@ async function showReferencesPanel(symbol: string, references: ReferenceItem[]):
202
204
  referencesSplitId = editor.getActiveSplitId();
203
205
 
204
206
  const limitMsg = references.length > MAX_RESULTS
205
- ? ` (showing first ${MAX_RESULTS})`
207
+ ? editor.t("status.showing_first", { max: String(MAX_RESULTS) })
206
208
  : "";
207
209
  editor.setStatus(
208
- `Found ${references.length} reference(s)${limitMsg} - ↑/↓ navigate, RET jump, q close`
210
+ editor.t("status.found_references", { count: String(references.length), limit: limitMsg })
209
211
  );
210
212
  editor.debug(`References panel opened with buffer ID ${referencesBufferId}, split ID ${referencesSplitId}`);
211
213
  } catch (error) {
212
214
  const errorMessage = error instanceof Error ? error.message : String(error);
213
- editor.setStatus("Failed to open references panel");
215
+ editor.setStatus(editor.t("status.failed_open_panel"));
214
216
  editor.debug(`ERROR: createVirtualBufferInSplit failed: ${errorMessage}`);
215
217
  }
216
218
  }
@@ -220,7 +222,7 @@ globalThis.on_lsp_references = function (data: { symbol: string; locations: Refe
220
222
  editor.debug(`Received ${data.locations.length} references for '${data.symbol}'`);
221
223
 
222
224
  if (data.locations.length === 0) {
223
- editor.setStatus(`No references found for '${data.symbol}'`);
225
+ editor.setStatus(editor.t("status.no_references", { symbol: data.symbol }));
224
226
  return;
225
227
  }
226
228
 
@@ -254,7 +256,7 @@ globalThis.on_references_cursor_moved = function (data: {
254
256
  const refIndex = cursorLine - 1;
255
257
 
256
258
  if (refIndex >= 0 && refIndex < currentReferences.length) {
257
- editor.setStatus(`Reference ${refIndex + 1}/${currentReferences.length}`);
259
+ editor.setStatus(editor.t("status.reference_index", { current: String(refIndex + 1), total: String(currentReferences.length) }));
258
260
  }
259
261
  };
260
262
 
@@ -283,18 +285,18 @@ globalThis.hide_references_panel = function (): void {
283
285
  currentReferences = [];
284
286
  currentSymbol = "";
285
287
  lineCache.clear();
286
- editor.setStatus("References panel closed");
288
+ editor.setStatus(editor.t("status.closed"));
287
289
  };
288
290
 
289
291
  // Navigation: go to selected reference (based on cursor position)
290
292
  globalThis.references_goto = function (): void {
291
293
  if (currentReferences.length === 0) {
292
- editor.setStatus("No references to jump to");
294
+ editor.setStatus(editor.t("status.no_references_to_jump"));
293
295
  return;
294
296
  }
295
297
 
296
298
  if (sourceSplitId === null) {
297
- editor.setStatus("Source split not available");
299
+ editor.setStatus(editor.t("status.source_split_unavailable"));
298
300
  return;
299
301
  }
300
302
 
@@ -321,14 +323,14 @@ globalThis.references_goto = function (): void {
321
323
  location.column || 0
322
324
  );
323
325
  const displayPath = getRelativePath(location.file);
324
- editor.setStatus(`Jumped to ${displayPath}:${location.line}`);
326
+ editor.setStatus(editor.t("status.jumped_to", { file: displayPath, line: String(location.line) }));
325
327
  } else {
326
328
  editor.debug(`references_goto: no location in props[0]`);
327
- editor.setStatus("Move cursor to a reference line");
329
+ editor.setStatus(editor.t("status.move_cursor"));
328
330
  }
329
331
  } else {
330
332
  editor.debug(`references_goto: no props found at cursor`);
331
- editor.setStatus("Move cursor to a reference line");
333
+ editor.setStatus(editor.t("status.move_cursor"));
332
334
  }
333
335
  };
334
336
 
@@ -339,19 +341,19 @@ globalThis.references_close = function (): void {
339
341
 
340
342
  // Register commands
341
343
  editor.registerCommand(
342
- "Show References Panel",
343
- "Display current references",
344
+ "%cmd.show_references",
345
+ "%cmd.show_references_desc",
344
346
  "show_references_panel",
345
347
  "normal"
346
348
  );
347
349
 
348
350
  editor.registerCommand(
349
- "Hide References Panel",
350
- "Close the references panel",
351
+ "%cmd.hide_references",
352
+ "%cmd.hide_references_desc",
351
353
  "hide_references_panel",
352
354
  "normal"
353
355
  );
354
356
 
355
357
  // Plugin initialization
356
- editor.setStatus("Find References plugin loaded");
358
+ editor.setStatus(editor.t("status.ready"));
357
359
  editor.debug("Find References plugin initialized");