@involvex/fresh-editor 0.1.76 → 0.1.78

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 (90) hide show
  1. package/bin/CHANGELOG.md +1017 -0
  2. package/bin/LICENSE +117 -0
  3. package/bin/README.md +248 -0
  4. package/bin/fresh.exe +0 -0
  5. package/bin/plugins/README.md +71 -0
  6. package/bin/plugins/audit_mode.i18n.json +821 -0
  7. package/bin/plugins/audit_mode.ts +1810 -0
  8. package/bin/plugins/buffer_modified.i18n.json +67 -0
  9. package/bin/plugins/buffer_modified.ts +281 -0
  10. package/bin/plugins/calculator.i18n.json +93 -0
  11. package/bin/plugins/calculator.ts +770 -0
  12. package/bin/plugins/clangd-lsp.ts +168 -0
  13. package/bin/plugins/clangd_support.i18n.json +223 -0
  14. package/bin/plugins/clangd_support.md +20 -0
  15. package/bin/plugins/clangd_support.ts +325 -0
  16. package/bin/plugins/color_highlighter.i18n.json +145 -0
  17. package/bin/plugins/color_highlighter.ts +304 -0
  18. package/bin/plugins/config-schema.json +768 -0
  19. package/bin/plugins/csharp-lsp.ts +147 -0
  20. package/bin/plugins/csharp_support.i18n.json +80 -0
  21. package/bin/plugins/csharp_support.ts +170 -0
  22. package/bin/plugins/css-lsp.ts +143 -0
  23. package/bin/plugins/diagnostics_panel.i18n.json +236 -0
  24. package/bin/plugins/diagnostics_panel.ts +642 -0
  25. package/bin/plugins/examples/README.md +85 -0
  26. package/bin/plugins/examples/async_demo.ts +165 -0
  27. package/bin/plugins/examples/bookmarks.ts +329 -0
  28. package/bin/plugins/examples/buffer_query_demo.ts +110 -0
  29. package/bin/plugins/examples/git_grep.ts +262 -0
  30. package/bin/plugins/examples/hello_world.ts +93 -0
  31. package/bin/plugins/examples/virtual_buffer_demo.ts +116 -0
  32. package/bin/plugins/find_references.i18n.json +275 -0
  33. package/bin/plugins/find_references.ts +359 -0
  34. package/bin/plugins/git_blame.i18n.json +496 -0
  35. package/bin/plugins/git_blame.ts +707 -0
  36. package/bin/plugins/git_find_file.i18n.json +314 -0
  37. package/bin/plugins/git_find_file.ts +300 -0
  38. package/bin/plugins/git_grep.i18n.json +171 -0
  39. package/bin/plugins/git_grep.ts +191 -0
  40. package/bin/plugins/git_gutter.i18n.json +93 -0
  41. package/bin/plugins/git_gutter.ts +477 -0
  42. package/bin/plugins/git_log.i18n.json +481 -0
  43. package/bin/plugins/git_log.ts +1285 -0
  44. package/bin/plugins/go-lsp.ts +143 -0
  45. package/bin/plugins/html-lsp.ts +145 -0
  46. package/bin/plugins/json-lsp.ts +145 -0
  47. package/bin/plugins/lib/fresh.d.ts +1321 -0
  48. package/bin/plugins/lib/index.ts +24 -0
  49. package/bin/plugins/lib/navigation-controller.ts +214 -0
  50. package/bin/plugins/lib/panel-manager.ts +220 -0
  51. package/bin/plugins/lib/types.ts +72 -0
  52. package/bin/plugins/lib/virtual-buffer-factory.ts +130 -0
  53. package/bin/plugins/live_grep.i18n.json +171 -0
  54. package/bin/plugins/live_grep.ts +422 -0
  55. package/bin/plugins/markdown_compose.i18n.json +223 -0
  56. package/bin/plugins/markdown_compose.ts +630 -0
  57. package/bin/plugins/merge_conflict.i18n.json +821 -0
  58. package/bin/plugins/merge_conflict.ts +1810 -0
  59. package/bin/plugins/path_complete.i18n.json +80 -0
  60. package/bin/plugins/path_complete.ts +165 -0
  61. package/bin/plugins/python-lsp.ts +162 -0
  62. package/bin/plugins/rust-lsp.ts +166 -0
  63. package/bin/plugins/search_replace.i18n.json +405 -0
  64. package/bin/plugins/search_replace.ts +484 -0
  65. package/bin/plugins/test_i18n.i18n.json +67 -0
  66. package/bin/plugins/test_i18n.ts +18 -0
  67. package/bin/plugins/theme_editor.i18n.json +3746 -0
  68. package/bin/plugins/theme_editor.ts +2063 -0
  69. package/bin/plugins/todo_highlighter.i18n.json +184 -0
  70. package/bin/plugins/todo_highlighter.ts +206 -0
  71. package/bin/plugins/typescript-lsp.ts +167 -0
  72. package/bin/plugins/vi_mode.i18n.json +1549 -0
  73. package/bin/plugins/vi_mode.ts +2747 -0
  74. package/bin/plugins/welcome.i18n.json +236 -0
  75. package/bin/plugins/welcome.ts +76 -0
  76. package/bin/themes/dark.json +102 -0
  77. package/bin/themes/dracula.json +62 -0
  78. package/bin/themes/high-contrast.json +102 -0
  79. package/bin/themes/light.json +102 -0
  80. package/bin/themes/nord.json +62 -0
  81. package/bin/themes/nostalgia.json +102 -0
  82. package/bin/themes/solarized-dark.json +62 -0
  83. package/binary-install.js +1 -1
  84. package/dist/bin/fresh.js +9 -0
  85. package/dist/binary-install.js +149 -0
  86. package/dist/binary.js +30 -0
  87. package/dist/fresh-6yhknp07.exe +0 -0
  88. package/dist/install.js +158 -0
  89. package/dist/run-fresh.js +43 -0
  90. package/package.json +7 -2
@@ -0,0 +1,275 @@
1
+ {
2
+ "cs": {
3
+ "cmd.show_references": "Zobrazit panel odkazu",
4
+ "cmd.show_references_desc": "Zobrazit aktualni odkazy",
5
+ "cmd.hide_references": "Skryt panel odkazu",
6
+ "cmd.hide_references_desc": "Zavrit panel odkazu",
7
+ "status.ready": "Plugin Najit odkazy nacten",
8
+ "status.no_references": "Zadne odkazy pro '{symbol}' nenalezeny",
9
+ "status.found_references": "Nalezeno {count} odkazu{limit} - Nahoru/Dolu navigace, RET skok, q zavrit",
10
+ "status.showing_first": " (zobrazuji prvnich {max})",
11
+ "status.reference_index": "Odkaz {current}/{total}",
12
+ "status.jumped_to": "Skok na {file}:{line}",
13
+ "status.no_references_to_jump": "Zadne odkazy k preskoceni",
14
+ "status.source_split_unavailable": "Rozdeleni zdroje neni k dispozici",
15
+ "status.move_cursor": "Presunte kurzor na radek odkazu",
16
+ "status.closed": "Panel odkazu zavren",
17
+ "status.failed_open_panel": "Nepodarilo se otevrit panel odkazu",
18
+ "panel.header": "Odkazy na {symbol} ({count}{limit})",
19
+ "panel.limited": ", omezeno na {max}",
20
+ "panel.no_references": "Zadne odkazy nenalezeny",
21
+ "panel.help": "[Nahoru/Dolu] navigace [RET] skok [q/Esc] zavrit"
22
+ },
23
+ "de": {
24
+ "cmd.show_references": "Referenzen-Panel anzeigen",
25
+ "cmd.show_references_desc": "Aktuelle Referenzen anzeigen",
26
+ "cmd.hide_references": "Referenzen-Panel ausblenden",
27
+ "cmd.hide_references_desc": "Das Referenzen-Panel schliessen",
28
+ "status.ready": "Referenzen-Plugin geladen",
29
+ "status.no_references": "Keine Referenzen fur '{symbol}' gefunden",
30
+ "status.found_references": "{count} Referenz(en) gefunden{limit} - Auf/Ab navigieren, RET springen, q schliessen",
31
+ "status.showing_first": " (zeige erste {max})",
32
+ "status.reference_index": "Referenz {current}/{total}",
33
+ "status.jumped_to": "Gesprungen zu {file}:{line}",
34
+ "status.no_references_to_jump": "Keine Referenzen zum Springen",
35
+ "status.source_split_unavailable": "Quell-Split nicht verfugbar",
36
+ "status.move_cursor": "Cursor auf eine Referenzzeile bewegen",
37
+ "status.closed": "Referenzen-Panel geschlossen",
38
+ "status.failed_open_panel": "Fehler beim Offnen des Referenzen-Panels",
39
+ "panel.header": "Referenzen zu {symbol} ({count}{limit})",
40
+ "panel.limited": ", begrenzt auf {max}",
41
+ "panel.no_references": "Keine Referenzen gefunden",
42
+ "panel.help": "[Auf/Ab] navigieren [RET] springen [q/Esc] schliessen"
43
+ },
44
+ "en": {
45
+ "cmd.show_references": "Show References Panel",
46
+ "cmd.show_references_desc": "Display current references",
47
+ "cmd.hide_references": "Hide References Panel",
48
+ "cmd.hide_references_desc": "Close the references panel",
49
+ "status.ready": "Find References plugin loaded",
50
+ "status.no_references": "No references found for '{symbol}'",
51
+ "status.found_references": "Found {count} reference(s){limit} - Up/Down navigate, RET jump, q close",
52
+ "status.showing_first": " (showing first {max})",
53
+ "status.reference_index": "Reference {current}/{total}",
54
+ "status.jumped_to": "Jumped to {file}:{line}",
55
+ "status.no_references_to_jump": "No references to jump to",
56
+ "status.source_split_unavailable": "Source split not available",
57
+ "status.move_cursor": "Move cursor to a reference line",
58
+ "status.closed": "References panel closed",
59
+ "status.failed_open_panel": "Failed to open references panel",
60
+ "panel.header": "References to {symbol} ({count}{limit})",
61
+ "panel.limited": ", limited to {max}",
62
+ "panel.no_references": "No references found",
63
+ "panel.help": "[Up/Down] navigate [RET] jump [q/Esc] close"
64
+ },
65
+ "es": {
66
+ "cmd.show_references": "Mostrar Panel de Referencias",
67
+ "cmd.show_references_desc": "Mostrar las referencias actuales",
68
+ "cmd.hide_references": "Ocultar Panel de Referencias",
69
+ "cmd.hide_references_desc": "Cerrar el panel de referencias",
70
+ "status.ready": "Plugin Buscar Referencias cargado",
71
+ "status.no_references": "No se encontraron referencias para '{symbol}'",
72
+ "status.found_references": "Se encontraron {count} referencia(s){limit} - Arriba/Abajo navegar, RET saltar, q cerrar",
73
+ "status.showing_first": " (mostrando primeros {max})",
74
+ "status.reference_index": "Referencia {current}/{total}",
75
+ "status.jumped_to": "Salto a {file}:{line}",
76
+ "status.no_references_to_jump": "No hay referencias a las que saltar",
77
+ "status.source_split_unavailable": "Division de origen no disponible",
78
+ "status.move_cursor": "Mueve el cursor a una linea de referencia",
79
+ "status.closed": "Panel de referencias cerrado",
80
+ "status.failed_open_panel": "Error al abrir el panel de referencias",
81
+ "panel.header": "Referencias a {symbol} ({count}{limit})",
82
+ "panel.limited": ", limitado a {max}",
83
+ "panel.no_references": "No se encontraron referencias",
84
+ "panel.help": "[Arriba/Abajo] navegar [RET] saltar [q/Esc] cerrar"
85
+ },
86
+ "fr": {
87
+ "cmd.show_references": "Afficher le panneau des references",
88
+ "cmd.show_references_desc": "Afficher les references actuelles",
89
+ "cmd.hide_references": "Masquer le panneau des references",
90
+ "cmd.hide_references_desc": "Fermer le panneau des references",
91
+ "status.ready": "Plugin Trouver les References charge",
92
+ "status.no_references": "Aucune reference trouvee pour '{symbol}'",
93
+ "status.found_references": "{count} reference(s) trouvee(s){limit} - Haut/Bas naviguer, RET sauter, q fermer",
94
+ "status.showing_first": " (affichage des {max} premiers)",
95
+ "status.reference_index": "Reference {current}/{total}",
96
+ "status.jumped_to": "Saute a {file}:{line}",
97
+ "status.no_references_to_jump": "Aucune reference vers laquelle sauter",
98
+ "status.source_split_unavailable": "Panneau source non disponible",
99
+ "status.move_cursor": "Deplacez le curseur sur une ligne de reference",
100
+ "status.closed": "Panneau des references ferme",
101
+ "status.failed_open_panel": "Echec de l'ouverture du panneau des references",
102
+ "panel.header": "References a {symbol} ({count}{limit})",
103
+ "panel.limited": ", limite a {max}",
104
+ "panel.no_references": "Aucune reference trouvee",
105
+ "panel.help": "[Haut/Bas] naviguer [RET] sauter [q/Esc] fermer"
106
+ },
107
+ "it": {
108
+ "cmd.show_references": "Mostra pannello riferimenti",
109
+ "cmd.show_references_desc": "Visualizza i riferimenti correnti",
110
+ "cmd.hide_references": "Nascondi pannello riferimenti",
111
+ "cmd.hide_references_desc": "Chiudi il pannello riferimenti",
112
+ "status.ready": "Plugin Trova riferimenti caricato",
113
+ "status.no_references": "Nessun riferimento trovato per '{symbol}'",
114
+ "status.found_references": "Trovati {count} riferimenti{limit} - Su/Giù naviga, RET vai a, q chiudi",
115
+ "status.showing_first": " (visualizzati i primi {max})",
116
+ "status.reference_index": "Riferimento {current}/{total}",
117
+ "status.jumped_to": "Passato a {file}:{line}",
118
+ "status.no_references_to_jump": "Nessun riferimento a cui passare",
119
+ "status.source_split_unavailable": "Split sorgente non disponibile",
120
+ "status.move_cursor": "Sposta il cursore su una riga di riferimento",
121
+ "status.closed": "Pannello riferimenti chiuso",
122
+ "status.failed_open_panel": "Impossibile aprire il pannello riferimenti",
123
+ "panel.header": "Riferimenti a {symbol} ({count}{limit})",
124
+ "panel.limited": ", limitati a {max}",
125
+ "panel.no_references": "Nessun riferimento trovato",
126
+ "panel.help": "[Su/Giù] naviga [RET] vai a [q/Esc] chiudi"
127
+ },
128
+ "ja": {
129
+ "cmd.show_references": "参照パネルを表示",
130
+ "cmd.show_references_desc": "現在の参照を表示",
131
+ "cmd.hide_references": "参照パネルを非表示",
132
+ "cmd.hide_references_desc": "参照パネルを閉じる",
133
+ "status.ready": "参照検索プラグインが読み込まれました",
134
+ "status.no_references": "'{symbol}' の参照が見つかりません",
135
+ "status.found_references": "{count} 件の参照が見つかりました{limit} - 上/下で移動、RETでジャンプ、qで閉じる",
136
+ "status.showing_first": " (最初の {max} 件を表示)",
137
+ "status.reference_index": "参照 {current}/{total}",
138
+ "status.jumped_to": "{file}:{line} にジャンプしました",
139
+ "status.no_references_to_jump": "ジャンプする参照がありません",
140
+ "status.source_split_unavailable": "ソース分割が利用できません",
141
+ "status.move_cursor": "カーソルを参照行に移動してください",
142
+ "status.closed": "参照パネルを閉じました",
143
+ "status.failed_open_panel": "参照パネルを開けませんでした",
144
+ "panel.header": "{symbol} への参照 ({count}{limit})",
145
+ "panel.limited": "、最大 {max} 件",
146
+ "panel.no_references": "参照が見つかりません",
147
+ "panel.help": "[上/下] 移動 [RET] ジャンプ [q/Esc] 閉じる"
148
+ },
149
+ "ko": {
150
+ "cmd.show_references": "참조 패널 표시",
151
+ "cmd.show_references_desc": "현재 참조 표시",
152
+ "cmd.hide_references": "참조 패널 숨기기",
153
+ "cmd.hide_references_desc": "참조 패널 닫기",
154
+ "status.ready": "참조 찾기 플러그인이 로드되었습니다",
155
+ "status.no_references": "'{symbol}'에 대한 참조를 찾을 수 없습니다",
156
+ "status.found_references": "{count}개의 참조를 찾았습니다{limit} - 위/아래 탐색, RET 이동, q 닫기",
157
+ "status.showing_first": " (처음 {max}개 표시)",
158
+ "status.reference_index": "참조 {current}/{total}",
159
+ "status.jumped_to": "{file}:{line}(으)로 이동했습니다",
160
+ "status.no_references_to_jump": "이동할 참조가 없습니다",
161
+ "status.source_split_unavailable": "소스 분할을 사용할 수 없습니다",
162
+ "status.move_cursor": "커서를 참조 줄로 이동하세요",
163
+ "status.closed": "참조 패널이 닫혔습니다",
164
+ "status.failed_open_panel": "참조 패널을 열 수 없습니다",
165
+ "panel.header": "{symbol}에 대한 참조 ({count}{limit})",
166
+ "panel.limited": ", {max}개로 제한",
167
+ "panel.no_references": "참조를 찾을 수 없습니다",
168
+ "panel.help": "[위/아래] 탐색 [RET] 이동 [q/Esc] 닫기"
169
+ },
170
+ "pt-BR": {
171
+ "cmd.show_references": "Mostrar Painel de Referencias",
172
+ "cmd.show_references_desc": "Exibir referencias atuais",
173
+ "cmd.hide_references": "Ocultar Painel de Referencias",
174
+ "cmd.hide_references_desc": "Fechar o painel de referencias",
175
+ "status.ready": "Plugin Encontrar Referencias carregado",
176
+ "status.no_references": "Nenhuma referencia encontrada para '{symbol}'",
177
+ "status.found_references": "Encontradas {count} referencia(s){limit} - Cima/Baixo navegar, RET pular, q fechar",
178
+ "status.showing_first": " (mostrando primeiras {max})",
179
+ "status.reference_index": "Referencia {current}/{total}",
180
+ "status.jumped_to": "Pulou para {file}:{line}",
181
+ "status.no_references_to_jump": "Nenhuma referencia para pular",
182
+ "status.source_split_unavailable": "Divisao de origem nao disponivel",
183
+ "status.move_cursor": "Mova o cursor para uma linha de referencia",
184
+ "status.closed": "Painel de referencias fechado",
185
+ "status.failed_open_panel": "Falha ao abrir o painel de referencias",
186
+ "panel.header": "Referencias a {symbol} ({count}{limit})",
187
+ "panel.limited": ", limitado a {max}",
188
+ "panel.no_references": "Nenhuma referencia encontrada",
189
+ "panel.help": "[Cima/Baixo] navegar [RET] pular [q/Esc] fechar"
190
+ },
191
+ "ru": {
192
+ "cmd.show_references": "Показать панель ссылок",
193
+ "cmd.show_references_desc": "Показать текущие ссылки",
194
+ "cmd.hide_references": "Скрыть панель ссылок",
195
+ "cmd.hide_references_desc": "Закрыть панель ссылок",
196
+ "status.ready": "Плагин поиска ссылок загружен",
197
+ "status.no_references": "Ссылки для '{symbol}' не найдены",
198
+ "status.found_references": "Найдено {count} ссылок{limit} - Вверх/Вниз навигация, RET переход, q закрыть",
199
+ "status.showing_first": " (показаны первые {max})",
200
+ "status.reference_index": "Ссылка {current}/{total}",
201
+ "status.jumped_to": "Переход к {file}:{line}",
202
+ "status.no_references_to_jump": "Нет ссылок для перехода",
203
+ "status.source_split_unavailable": "Разделение источника недоступно",
204
+ "status.move_cursor": "Переместите курсор на строку ссылки",
205
+ "status.closed": "Панель ссылок закрыта",
206
+ "status.failed_open_panel": "Не удалось открыть панель ссылок",
207
+ "panel.header": "Ссылки на {symbol} ({count}{limit})",
208
+ "panel.limited": ", ограничено до {max}",
209
+ "panel.no_references": "Ссылки не найдены",
210
+ "panel.help": "[Вверх/Вниз] навигация [RET] переход [q/Esc] закрыть"
211
+ },
212
+ "th": {
213
+ "cmd.show_references": "แสดงแผงการอ้างอิง",
214
+ "cmd.show_references_desc": "แสดงการอ้างอิงปัจจุบัน",
215
+ "cmd.hide_references": "ซ่อนแผงการอ้างอิง",
216
+ "cmd.hide_references_desc": "ปิดแผงการอ้างอิง",
217
+ "status.ready": "โหลดปลั๊กอินค้นหาการอ้างอิงแล้ว",
218
+ "status.no_references": "ไม่พบการอ้างอิงสำหรับ '{symbol}'",
219
+ "status.found_references": "พบ {count} การอ้างอิง{limit} - ขึ้น/ลง นำทาง, RET ข้าม, q ปิด",
220
+ "status.showing_first": " (แสดง {max} รายการแรก)",
221
+ "status.reference_index": "การอ้างอิง {current}/{total}",
222
+ "status.jumped_to": "ข้ามไปที่ {file}:{line}",
223
+ "status.no_references_to_jump": "ไม่มีการอ้างอิงให้ข้าม",
224
+ "status.source_split_unavailable": "การแยกแหล่งที่มาไม่พร้อมใช้งาน",
225
+ "status.move_cursor": "เลื่อนเคอร์เซอร์ไปที่บรรทัดการอ้างอิง",
226
+ "status.closed": "ปิดแผงการอ้างอิงแล้ว",
227
+ "status.failed_open_panel": "ไม่สามารถเปิดแผงการอ้างอิง",
228
+ "panel.header": "การอ้างอิงถึง {symbol} ({count}{limit})",
229
+ "panel.limited": ", จำกัด {max}",
230
+ "panel.no_references": "ไม่พบการอ้างอิง",
231
+ "panel.help": "[ขึ้น/ลง] นำทาง [RET] ข้าม [q/Esc] ปิด"
232
+ },
233
+ "uk": {
234
+ "cmd.show_references": "Показати панель посилань",
235
+ "cmd.show_references_desc": "Показати поточні посилання",
236
+ "cmd.hide_references": "Сховати панель посилань",
237
+ "cmd.hide_references_desc": "Закрити панель посилань",
238
+ "status.ready": "Плагін пошуку посилань завантажено",
239
+ "status.no_references": "Посилання для '{symbol}' не знайдено",
240
+ "status.found_references": "Знайдено {count} посилань{limit} - Вгору/Вниз навігація, RET перехід, q закрити",
241
+ "status.showing_first": " (показано перші {max})",
242
+ "status.reference_index": "Посилання {current}/{total}",
243
+ "status.jumped_to": "Перехід до {file}:{line}",
244
+ "status.no_references_to_jump": "Немає посилань для переходу",
245
+ "status.source_split_unavailable": "Розділення джерела недоступне",
246
+ "status.move_cursor": "Перемістіть курсор на рядок посилання",
247
+ "status.closed": "Панель посилань закрито",
248
+ "status.failed_open_panel": "Не вдалося відкрити панель посилань",
249
+ "panel.header": "Посилання на {symbol} ({count}{limit})",
250
+ "panel.limited": ", обмежено до {max}",
251
+ "panel.no_references": "Посилання не знайдено",
252
+ "panel.help": "[Вгору/Вниз] навігація [RET] перехід [q/Esc] закрити"
253
+ },
254
+ "zh-CN": {
255
+ "cmd.show_references": "显示引用面板",
256
+ "cmd.show_references_desc": "显示当前引用",
257
+ "cmd.hide_references": "隐藏引用面板",
258
+ "cmd.hide_references_desc": "关闭引用面板",
259
+ "status.ready": "查找引用插件已加载",
260
+ "status.no_references": "未找到 '{symbol}' 的引用",
261
+ "status.found_references": "找到 {count} 个引用{limit} - 上/下导航,回车跳转,q 关闭",
262
+ "status.showing_first": " (显示前 {max} 个)",
263
+ "status.reference_index": "引用 {current}/{total}",
264
+ "status.jumped_to": "跳转到 {file}:{line}",
265
+ "status.no_references_to_jump": "没有可跳转的引用",
266
+ "status.source_split_unavailable": "源分割不可用",
267
+ "status.move_cursor": "将光标移动到引用行",
268
+ "status.closed": "引用面板已关闭",
269
+ "status.failed_open_panel": "无法打开引用面板",
270
+ "panel.header": "{symbol} 的引用 ({count}{limit})",
271
+ "panel.limited": ",限制为 {max}",
272
+ "panel.no_references": "未找到引用",
273
+ "panel.help": "[上/下] 导航 [回车] 跳转 [q/Esc] 关闭"
274
+ }
275
+ }
@@ -0,0 +1,359 @@
1
+ /// <reference path="../types/fresh.d.ts" />
2
+ const editor = getEditor();
3
+
4
+
5
+ /**
6
+ * Find References Plugin (TypeScript)
7
+ *
8
+ * Displays LSP find references results in a virtual buffer split view.
9
+ * Listens for lsp_references hook from the editor and shows results.
10
+ * Uses cursor movement for navigation (Up/Down/j/k work naturally).
11
+ */
12
+
13
+ // Panel state
14
+ let panelOpen = false;
15
+ let referencesBufferId: number | null = null;
16
+ let sourceSplitId: number | null = null;
17
+ let referencesSplitId: number | null = null; // Track the split we created
18
+ let currentReferences: ReferenceItem[] = [];
19
+ let currentSymbol: string = "";
20
+ let lineCache: Map<string, string[]> = new Map(); // Cache file contents
21
+
22
+ // Maximum number of results to display
23
+ const MAX_RESULTS = 100;
24
+
25
+ // Reference item structure
26
+ interface ReferenceItem {
27
+ file: string;
28
+ line: number;
29
+ column: number;
30
+ lineText?: string; // Cached line text
31
+ }
32
+
33
+ // Define the references mode with minimal keybindings
34
+ // Navigation uses normal cursor movement (arrows, j/k work naturally)
35
+ editor.defineMode(
36
+ "references-list",
37
+ null, // no parent mode
38
+ [
39
+ ["Return", "references_goto"],
40
+ ["q", "references_close"],
41
+ ["Escape", "references_close"],
42
+ ],
43
+ true // read-only
44
+ );
45
+
46
+ // Get relative path for display
47
+ function getRelativePath(filePath: string): string {
48
+ const cwd = editor.getCwd();
49
+ if (filePath.startsWith(cwd)) {
50
+ return filePath.slice(cwd.length + 1); // Remove cwd and leading /
51
+ }
52
+ return filePath;
53
+ }
54
+
55
+ // Format a reference for display with line preview
56
+ function formatReference(item: ReferenceItem): string {
57
+ const displayPath = getRelativePath(item.file);
58
+ const location = `${displayPath}:${item.line}:${item.column}`;
59
+
60
+ // Truncate location if too long, leaving room for line text
61
+ const maxLocationLen = 50;
62
+ const truncatedLocation = location.length > maxLocationLen
63
+ ? "..." + location.slice(-(maxLocationLen - 3))
64
+ : location.padEnd(maxLocationLen);
65
+
66
+ // Get line text preview (truncated)
67
+ const lineText = item.lineText || "";
68
+ const trimmedLine = lineText.trim();
69
+ const maxLineLen = 60;
70
+ const displayLine = trimmedLine.length > maxLineLen
71
+ ? trimmedLine.slice(0, maxLineLen - 3) + "..."
72
+ : trimmedLine;
73
+
74
+ return ` ${truncatedLocation} ${displayLine}\n`;
75
+ }
76
+
77
+ // Build entries for the virtual buffer
78
+ function buildPanelEntries(): TextPropertyEntry[] {
79
+ const entries: TextPropertyEntry[] = [];
80
+
81
+ // Header with symbol name
82
+ const totalCount = currentReferences.length;
83
+ const limitNote = totalCount >= MAX_RESULTS ? editor.t("panel.limited", { max: String(MAX_RESULTS) }) : "";
84
+ const symbolDisplay = currentSymbol ? `'${currentSymbol}'` : "symbol";
85
+ entries.push({
86
+ text: `═══ ${editor.t("panel.header", { symbol: symbolDisplay, count: String(totalCount), limit: limitNote })} ═══\n`,
87
+ properties: { type: "header" },
88
+ });
89
+
90
+ if (currentReferences.length === 0) {
91
+ entries.push({
92
+ text: " " + editor.t("panel.no_references") + "\n",
93
+ properties: { type: "empty" },
94
+ });
95
+ } else {
96
+ // Add each reference
97
+ for (let i = 0; i < currentReferences.length; i++) {
98
+ const ref = currentReferences[i];
99
+ entries.push({
100
+ text: formatReference(ref),
101
+ properties: {
102
+ type: "reference",
103
+ index: i,
104
+ location: {
105
+ file: ref.file,
106
+ line: ref.line,
107
+ column: ref.column,
108
+ },
109
+ },
110
+ });
111
+ }
112
+ }
113
+
114
+ // Footer
115
+ entries.push({
116
+ text: `───────────────────────────────────────────────────────────────────────────────\n`,
117
+ properties: { type: "separator" },
118
+ });
119
+ entries.push({
120
+ text: editor.t("panel.help") + "\n",
121
+ properties: { type: "help" },
122
+ });
123
+
124
+ return entries;
125
+ }
126
+
127
+ // Load line text for references
128
+ async function loadLineTexts(references: ReferenceItem[]): Promise<void> {
129
+ // Group references by file
130
+ const fileRefs: Map<string, ReferenceItem[]> = new Map();
131
+ for (const ref of references) {
132
+ if (!fileRefs.has(ref.file)) {
133
+ fileRefs.set(ref.file, []);
134
+ }
135
+ fileRefs.get(ref.file)!.push(ref);
136
+ }
137
+
138
+ // Load each file and extract lines
139
+ for (const [filePath, refs] of fileRefs) {
140
+ try {
141
+ // Check cache first
142
+ let lines = lineCache.get(filePath);
143
+ if (!lines) {
144
+ const content = await editor.readFile(filePath);
145
+ lines = content.split("\n");
146
+ lineCache.set(filePath, lines);
147
+ }
148
+
149
+ // Set line text for each reference
150
+ for (const ref of refs) {
151
+ const lineIndex = ref.line - 1; // Convert 1-based to 0-based
152
+ if (lineIndex >= 0 && lineIndex < lines.length) {
153
+ ref.lineText = lines[lineIndex];
154
+ } else {
155
+ ref.lineText = "";
156
+ }
157
+ }
158
+ } catch (error) {
159
+ // If file can't be read, leave lineText empty
160
+ for (const ref of refs) {
161
+ ref.lineText = "";
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ // Show references panel
168
+ async function showReferencesPanel(symbol: string, references: ReferenceItem[]): Promise<void> {
169
+ // Only save the source split ID if panel is not already open
170
+ // (avoid overwriting it with the references split ID on subsequent calls)
171
+ if (!panelOpen) {
172
+ sourceSplitId = editor.getActiveSplitId();
173
+ }
174
+
175
+ // Limit results
176
+ const limitedRefs = references.slice(0, MAX_RESULTS);
177
+
178
+ // Set references and symbol
179
+ currentSymbol = symbol;
180
+ currentReferences = limitedRefs;
181
+
182
+ // Load line texts for preview
183
+ await loadLineTexts(currentReferences);
184
+
185
+ // Build panel entries
186
+ const entries = buildPanelEntries();
187
+
188
+ // Create or update virtual buffer in horizontal split
189
+ // The panel_id mechanism will reuse the existing buffer/split if it exists
190
+ try {
191
+ referencesBufferId = await editor.createVirtualBufferInSplit({
192
+ name: "*References*",
193
+ mode: "references-list",
194
+ read_only: true,
195
+ entries: entries,
196
+ ratio: 0.7, // Original pane takes 70%, references takes 30%
197
+ panel_id: "references-panel",
198
+ show_line_numbers: false,
199
+ show_cursors: true, // Enable cursor for navigation
200
+ });
201
+
202
+ panelOpen = true;
203
+ // Track the references split (it becomes active after creation)
204
+ referencesSplitId = editor.getActiveSplitId();
205
+
206
+ const limitMsg = references.length > MAX_RESULTS
207
+ ? editor.t("status.showing_first", { max: String(MAX_RESULTS) })
208
+ : "";
209
+ editor.setStatus(
210
+ editor.t("status.found_references", { count: String(references.length), limit: limitMsg })
211
+ );
212
+ editor.debug(`References panel opened with buffer ID ${referencesBufferId}, split ID ${referencesSplitId}`);
213
+ } catch (error) {
214
+ const errorMessage = error instanceof Error ? error.message : String(error);
215
+ editor.setStatus(editor.t("status.failed_open_panel"));
216
+ editor.debug(`ERROR: createVirtualBufferInSplit failed: ${errorMessage}`);
217
+ }
218
+ }
219
+
220
+ // Handle lsp_references hook
221
+ globalThis.on_lsp_references = function (data: { symbol: string; locations: ReferenceItem[] }): void {
222
+ editor.debug(`Received ${data.locations.length} references for '${data.symbol}'`);
223
+
224
+ if (data.locations.length === 0) {
225
+ editor.setStatus(editor.t("status.no_references", { symbol: data.symbol }));
226
+ return;
227
+ }
228
+
229
+ // Clear line cache for fresh results
230
+ lineCache.clear();
231
+
232
+ // Show the references panel
233
+ showReferencesPanel(data.symbol, data.locations);
234
+ };
235
+
236
+ // Register the hook handler
237
+ editor.on("lsp_references", "on_lsp_references");
238
+
239
+ // Handle cursor movement to show current reference info
240
+ globalThis.on_references_cursor_moved = function (data: {
241
+ buffer_id: number;
242
+ cursor_id: number;
243
+ old_position: number;
244
+ new_position: number;
245
+ }): void {
246
+ // Only handle cursor movement in our references buffer
247
+ if (referencesBufferId === null || data.buffer_id !== referencesBufferId) {
248
+ return;
249
+ }
250
+
251
+ // Get cursor line to determine which reference is selected
252
+ // getCursorLine() returns the line for the active buffer
253
+ const cursorLine = editor.getCursorLine();
254
+
255
+ // Line 0 is header, lines 1 to N are references
256
+ const refIndex = cursorLine - 1;
257
+
258
+ if (refIndex >= 0 && refIndex < currentReferences.length) {
259
+ editor.setStatus(editor.t("status.reference_index", { current: String(refIndex + 1), total: String(currentReferences.length) }));
260
+ }
261
+ };
262
+
263
+ // Register cursor movement handler
264
+ editor.on("cursor_moved", "on_references_cursor_moved");
265
+
266
+ // Hide references panel
267
+ globalThis.hide_references_panel = function (): void {
268
+ if (!panelOpen) {
269
+ return;
270
+ }
271
+
272
+ if (referencesBufferId !== null) {
273
+ editor.closeBuffer(referencesBufferId);
274
+ }
275
+
276
+ // Close the split we created (if it exists and is different from source)
277
+ if (referencesSplitId !== null && referencesSplitId !== sourceSplitId) {
278
+ editor.closeSplit(referencesSplitId);
279
+ }
280
+
281
+ panelOpen = false;
282
+ referencesBufferId = null;
283
+ sourceSplitId = null;
284
+ referencesSplitId = null;
285
+ currentReferences = [];
286
+ currentSymbol = "";
287
+ lineCache.clear();
288
+ editor.setStatus(editor.t("status.closed"));
289
+ };
290
+
291
+ // Navigation: go to selected reference (based on cursor position)
292
+ globalThis.references_goto = function (): void {
293
+ if (currentReferences.length === 0) {
294
+ editor.setStatus(editor.t("status.no_references_to_jump"));
295
+ return;
296
+ }
297
+
298
+ if (sourceSplitId === null) {
299
+ editor.setStatus(editor.t("status.source_split_unavailable"));
300
+ return;
301
+ }
302
+
303
+ if (referencesBufferId === null) {
304
+ return;
305
+ }
306
+
307
+ // Get text properties at cursor position
308
+ const props = editor.getTextPropertiesAtCursor(referencesBufferId);
309
+ editor.debug(`references_goto: props.length=${props.length}, referencesBufferId=${referencesBufferId}, sourceSplitId=${sourceSplitId}`);
310
+
311
+ if (props.length > 0) {
312
+ editor.debug(`references_goto: props[0]=${JSON.stringify(props[0])}`);
313
+ const location = props[0].location as
314
+ | { file: string; line: number; column: number }
315
+ | undefined;
316
+ if (location) {
317
+ editor.debug(`references_goto: opening ${location.file}:${location.line}:${location.column} in split ${sourceSplitId}`);
318
+ // Open file in the source split, not the references split
319
+ editor.openFileInSplit(
320
+ sourceSplitId,
321
+ location.file,
322
+ location.line,
323
+ location.column || 0
324
+ );
325
+ const displayPath = getRelativePath(location.file);
326
+ editor.setStatus(editor.t("status.jumped_to", { file: displayPath, line: String(location.line) }));
327
+ } else {
328
+ editor.debug(`references_goto: no location in props[0]`);
329
+ editor.setStatus(editor.t("status.move_cursor"));
330
+ }
331
+ } else {
332
+ editor.debug(`references_goto: no props found at cursor`);
333
+ editor.setStatus(editor.t("status.move_cursor"));
334
+ }
335
+ };
336
+
337
+ // Close the references panel
338
+ globalThis.references_close = function (): void {
339
+ globalThis.hide_references_panel();
340
+ };
341
+
342
+ // Register commands
343
+ editor.registerCommand(
344
+ "%cmd.show_references",
345
+ "%cmd.show_references_desc",
346
+ "show_references_panel",
347
+ "normal"
348
+ );
349
+
350
+ editor.registerCommand(
351
+ "%cmd.hide_references",
352
+ "%cmd.hide_references_desc",
353
+ "hide_references_panel",
354
+ "normal"
355
+ );
356
+
357
+ // Plugin initialization
358
+ editor.setStatus(editor.t("status.ready"));
359
+ editor.debug("Find References plugin initialized");