@fresh-editor/fresh-editor 0.1.67 → 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.
- package/CHANGELOG.md +58 -0
- package/README.md +2 -0
- package/package.json +1 -1
- package/plugins/audit_mode.i18n.json +380 -0
- package/plugins/audit_mode.ts +836 -68
- package/plugins/buffer_modified.i18n.json +32 -0
- package/plugins/buffer_modified.ts +5 -3
- package/plugins/calculator.i18n.json +44 -0
- package/plugins/calculator.ts +6 -4
- package/plugins/clangd-lsp.ts +2 -0
- package/plugins/clangd_support.i18n.json +104 -0
- package/plugins/clangd_support.ts +18 -16
- package/plugins/color_highlighter.i18n.json +68 -0
- package/plugins/color_highlighter.ts +12 -10
- package/plugins/config-schema.json +25 -140
- package/plugins/csharp-lsp.ts +2 -0
- package/plugins/csharp_support.i18n.json +38 -0
- package/plugins/csharp_support.ts +6 -4
- package/plugins/css-lsp.ts +2 -0
- package/plugins/diagnostics_panel.i18n.json +110 -0
- package/plugins/diagnostics_panel.ts +19 -17
- package/plugins/find_references.i18n.json +128 -0
- package/plugins/find_references.ts +22 -20
- package/plugins/git_blame.i18n.json +230 -0
- package/plugins/git_blame.ts +39 -37
- package/plugins/git_find_file.i18n.json +146 -0
- package/plugins/git_find_file.ts +24 -22
- package/plugins/git_grep.i18n.json +80 -0
- package/plugins/git_grep.ts +15 -13
- package/plugins/git_gutter.i18n.json +44 -0
- package/plugins/git_gutter.ts +7 -5
- package/plugins/git_log.i18n.json +224 -0
- package/plugins/git_log.ts +41 -39
- package/plugins/go-lsp.ts +2 -0
- package/plugins/html-lsp.ts +2 -0
- package/plugins/json-lsp.ts +2 -0
- package/plugins/lib/fresh.d.ts +53 -13
- package/plugins/lib/index.ts +1 -1
- package/plugins/lib/navigation-controller.ts +3 -3
- package/plugins/lib/panel-manager.ts +15 -13
- package/plugins/lib/virtual-buffer-factory.ts +84 -112
- package/plugins/live_grep.i18n.json +80 -0
- package/plugins/live_grep.ts +15 -13
- package/plugins/markdown_compose.i18n.json +104 -0
- package/plugins/markdown_compose.ts +17 -15
- package/plugins/merge_conflict.i18n.json +380 -0
- package/plugins/merge_conflict.ts +72 -73
- package/plugins/path_complete.i18n.json +38 -0
- package/plugins/path_complete.ts +6 -4
- package/plugins/python-lsp.ts +2 -0
- package/plugins/rust-lsp.ts +2 -0
- package/plugins/search_replace.i18n.json +188 -0
- package/plugins/search_replace.ts +31 -29
- package/plugins/test_i18n.i18n.json +12 -0
- package/plugins/test_i18n.ts +18 -0
- package/plugins/theme_editor.i18n.json +1417 -0
- package/plugins/theme_editor.ts +73 -69
- package/plugins/todo_highlighter.i18n.json +86 -0
- package/plugins/todo_highlighter.ts +15 -13
- package/plugins/typescript-lsp.ts +2 -0
- package/plugins/vi_mode.i18n.json +716 -0
- package/plugins/vi_mode.ts +1195 -78
- package/plugins/welcome.i18n.json +110 -0
- package/plugins/welcome.ts +18 -16
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"cmd.search_replace": "Search and Replace in Project",
|
|
4
|
+
"cmd.search_replace_desc": "Search and replace text across all git-tracked files",
|
|
5
|
+
"status.ready": "Search & Replace plugin ready",
|
|
6
|
+
"status.enter_pattern": "Enter search pattern...",
|
|
7
|
+
"status.no_matches": "No matches found for \"{pattern}\"",
|
|
8
|
+
"status.found_matches": "Found {count} matches",
|
|
9
|
+
"status.search_error": "Search error: {error}",
|
|
10
|
+
"status.cancelled_empty": "Search cancelled - empty pattern",
|
|
11
|
+
"status.cancelled": "Search/Replace cancelled",
|
|
12
|
+
"status.no_selected": "No items selected for replacement",
|
|
13
|
+
"status.no_items_selected": "No items selected",
|
|
14
|
+
"status.selected_count": "{selected}/{total} selected",
|
|
15
|
+
"status.replacing": "Replacing {count} occurrences...",
|
|
16
|
+
"status.replaced_with_errors": "Replaced in {files} files ({errors} errors)",
|
|
17
|
+
"status.replaced": "Replaced {count} occurrences in {files} files",
|
|
18
|
+
"status.closed": "Search/Replace closed",
|
|
19
|
+
"status.failed_open_panel": "Failed to open search/replace panel",
|
|
20
|
+
"status.preview": "Preview: {file}:{line}",
|
|
21
|
+
"prompt.search": "Search (in project): ",
|
|
22
|
+
"prompt.replace": "Replace with: ",
|
|
23
|
+
"panel.header": "Search & Replace",
|
|
24
|
+
"panel.search_label": "Search:",
|
|
25
|
+
"panel.replace_label": "Replace:",
|
|
26
|
+
"panel.regex": "(regex)",
|
|
27
|
+
"panel.no_matches": "No matches found",
|
|
28
|
+
"panel.results": "Results: {count}",
|
|
29
|
+
"panel.limited": "(limited to {max})",
|
|
30
|
+
"panel.selected": "({selected} selected)",
|
|
31
|
+
"panel.help": "[SPC] toggle [a] all [n] none [r] REPLACE [RET] preview [q] close"
|
|
32
|
+
},
|
|
33
|
+
"es": {
|
|
34
|
+
"cmd.search_replace": "Buscar y Reemplazar en Proyecto",
|
|
35
|
+
"cmd.search_replace_desc": "Buscar y reemplazar texto en todos los archivos rastreados por git",
|
|
36
|
+
"status.ready": "Plugin de Buscar y Reemplazar listo",
|
|
37
|
+
"status.enter_pattern": "Ingresa el patrón de búsqueda...",
|
|
38
|
+
"status.no_matches": "No se encontraron coincidencias para \"{pattern}\"",
|
|
39
|
+
"status.found_matches": "Se encontraron {count} coincidencias",
|
|
40
|
+
"status.search_error": "Error de búsqueda: {error}",
|
|
41
|
+
"status.cancelled_empty": "Búsqueda cancelada - patrón vacío",
|
|
42
|
+
"status.cancelled": "Buscar/Reemplazar cancelado",
|
|
43
|
+
"status.no_selected": "No hay elementos seleccionados para reemplazar",
|
|
44
|
+
"status.no_items_selected": "No hay elementos seleccionados",
|
|
45
|
+
"status.selected_count": "{selected}/{total} seleccionados",
|
|
46
|
+
"status.replacing": "Reemplazando {count} ocurrencias...",
|
|
47
|
+
"status.replaced_with_errors": "Reemplazado en {files} archivos ({errors} errores)",
|
|
48
|
+
"status.replaced": "Se reemplazaron {count} ocurrencias en {files} archivos",
|
|
49
|
+
"status.closed": "Buscar/Reemplazar cerrado",
|
|
50
|
+
"status.failed_open_panel": "Error al abrir el panel de buscar/reemplazar",
|
|
51
|
+
"status.preview": "Vista previa: {file}:{line}",
|
|
52
|
+
"prompt.search": "Buscar (en proyecto): ",
|
|
53
|
+
"prompt.replace": "Reemplazar con: ",
|
|
54
|
+
"panel.header": "Buscar y Reemplazar",
|
|
55
|
+
"panel.search_label": "Buscar:",
|
|
56
|
+
"panel.replace_label": "Reemplazar:",
|
|
57
|
+
"panel.regex": "(regex)",
|
|
58
|
+
"panel.no_matches": "No se encontraron coincidencias",
|
|
59
|
+
"panel.results": "Resultados: {count}",
|
|
60
|
+
"panel.limited": "(limitado a {max})",
|
|
61
|
+
"panel.selected": "({selected} seleccionados)",
|
|
62
|
+
"panel.help": "[ESP] alternar [a] todos [n] ninguno [r] REEMPLAZAR [RET] vista previa [q] cerrar"
|
|
63
|
+
},
|
|
64
|
+
"de": {
|
|
65
|
+
"cmd.search_replace": "Suchen und Ersetzen im Projekt",
|
|
66
|
+
"cmd.search_replace_desc": "Text in allen von Git verfolgten Dateien suchen und ersetzen",
|
|
67
|
+
"status.ready": "Suchen & Ersetzen Plugin bereit",
|
|
68
|
+
"status.enter_pattern": "Suchmuster eingeben...",
|
|
69
|
+
"status.no_matches": "Keine Treffer für \"{pattern}\" gefunden",
|
|
70
|
+
"status.found_matches": "{count} Treffer gefunden",
|
|
71
|
+
"status.search_error": "Suchfehler: {error}",
|
|
72
|
+
"status.cancelled_empty": "Suche abgebrochen - leeres Muster",
|
|
73
|
+
"status.cancelled": "Suchen/Ersetzen abgebrochen",
|
|
74
|
+
"status.no_selected": "Keine Elemente zum Ersetzen ausgewählt",
|
|
75
|
+
"status.no_items_selected": "Keine Elemente ausgewählt",
|
|
76
|
+
"status.selected_count": "{selected}/{total} ausgewählt",
|
|
77
|
+
"status.replacing": "Ersetze {count} Vorkommen...",
|
|
78
|
+
"status.replaced_with_errors": "Ersetzt in {files} Dateien ({errors} Fehler)",
|
|
79
|
+
"status.replaced": "{count} Vorkommen in {files} Dateien ersetzt",
|
|
80
|
+
"status.closed": "Suchen/Ersetzen geschlossen",
|
|
81
|
+
"status.failed_open_panel": "Fehler beim Öffnen des Suchen/Ersetzen-Panels",
|
|
82
|
+
"status.preview": "Vorschau: {file}:{line}",
|
|
83
|
+
"prompt.search": "Suchen (im Projekt): ",
|
|
84
|
+
"prompt.replace": "Ersetzen durch: ",
|
|
85
|
+
"panel.header": "Suchen & Ersetzen",
|
|
86
|
+
"panel.search_label": "Suchen:",
|
|
87
|
+
"panel.replace_label": "Ersetzen:",
|
|
88
|
+
"panel.regex": "(Regex)",
|
|
89
|
+
"panel.no_matches": "Keine Treffer gefunden",
|
|
90
|
+
"panel.results": "Ergebnisse: {count}",
|
|
91
|
+
"panel.limited": "(begrenzt auf {max})",
|
|
92
|
+
"panel.selected": "({selected} ausgewählt)",
|
|
93
|
+
"panel.help": "[LEER] umschalten [a] alle [n] keine [r] ERSETZEN [RET] Vorschau [q] schließen"
|
|
94
|
+
},
|
|
95
|
+
"fr": {
|
|
96
|
+
"cmd.search_replace": "Rechercher et Remplacer dans le Projet",
|
|
97
|
+
"cmd.search_replace_desc": "Rechercher et remplacer du texte dans tous les fichiers suivis par git",
|
|
98
|
+
"status.ready": "Plugin Rechercher et Remplacer prêt",
|
|
99
|
+
"status.enter_pattern": "Entrez le motif de recherche...",
|
|
100
|
+
"status.no_matches": "Aucune correspondance trouvée pour \"{pattern}\"",
|
|
101
|
+
"status.found_matches": "{count} correspondances trouvées",
|
|
102
|
+
"status.search_error": "Erreur de recherche : {error}",
|
|
103
|
+
"status.cancelled_empty": "Recherche annulée - motif vide",
|
|
104
|
+
"status.cancelled": "Rechercher/Remplacer annulé",
|
|
105
|
+
"status.no_selected": "Aucun élément sélectionné pour le remplacement",
|
|
106
|
+
"status.no_items_selected": "Aucun élément sélectionné",
|
|
107
|
+
"status.selected_count": "{selected}/{total} sélectionnés",
|
|
108
|
+
"status.replacing": "Remplacement de {count} occurrences...",
|
|
109
|
+
"status.replaced_with_errors": "Remplacé dans {files} fichiers ({errors} erreurs)",
|
|
110
|
+
"status.replaced": "{count} occurrences remplacées dans {files} fichiers",
|
|
111
|
+
"status.closed": "Rechercher/Remplacer fermé",
|
|
112
|
+
"status.failed_open_panel": "Échec de l'ouverture du panneau rechercher/remplacer",
|
|
113
|
+
"status.preview": "Aperçu : {file}:{line}",
|
|
114
|
+
"prompt.search": "Rechercher (dans le projet) : ",
|
|
115
|
+
"prompt.replace": "Remplacer par : ",
|
|
116
|
+
"panel.header": "Rechercher et Remplacer",
|
|
117
|
+
"panel.search_label": "Rechercher :",
|
|
118
|
+
"panel.replace_label": "Remplacer :",
|
|
119
|
+
"panel.regex": "(regex)",
|
|
120
|
+
"panel.no_matches": "Aucune correspondance trouvée",
|
|
121
|
+
"panel.results": "Résultats : {count}",
|
|
122
|
+
"panel.limited": "(limité à {max})",
|
|
123
|
+
"panel.selected": "({selected} sélectionnés)",
|
|
124
|
+
"panel.help": "[ESP] basculer [a] tous [n] aucun [r] REMPLACER [RET] aperçu [q] fermer"
|
|
125
|
+
},
|
|
126
|
+
"ja": {
|
|
127
|
+
"cmd.search_replace": "プロジェクト内で検索と置換",
|
|
128
|
+
"cmd.search_replace_desc": "git追跡されているすべてのファイルでテキストを検索して置換",
|
|
129
|
+
"status.ready": "検索と置換プラグイン準備完了",
|
|
130
|
+
"status.enter_pattern": "検索パターンを入力...",
|
|
131
|
+
"status.no_matches": "\"{pattern}\" に一致するものが見つかりません",
|
|
132
|
+
"status.found_matches": "{count} 件の一致が見つかりました",
|
|
133
|
+
"status.search_error": "検索エラー: {error}",
|
|
134
|
+
"status.cancelled_empty": "検索キャンセル - 空のパターン",
|
|
135
|
+
"status.cancelled": "検索/置換がキャンセルされました",
|
|
136
|
+
"status.no_selected": "置換対象が選択されていません",
|
|
137
|
+
"status.no_items_selected": "項目が選択されていません",
|
|
138
|
+
"status.selected_count": "{selected}/{total} 選択済み",
|
|
139
|
+
"status.replacing": "{count} 件を置換中...",
|
|
140
|
+
"status.replaced_with_errors": "{files} ファイルで置換しました ({errors} エラー)",
|
|
141
|
+
"status.replaced": "{files} ファイルで {count} 件を置換しました",
|
|
142
|
+
"status.closed": "検索/置換を閉じました",
|
|
143
|
+
"status.failed_open_panel": "検索/置換パネルを開けませんでした",
|
|
144
|
+
"status.preview": "プレビュー: {file}:{line}",
|
|
145
|
+
"prompt.search": "検索 (プロジェクト内): ",
|
|
146
|
+
"prompt.replace": "置換文字列: ",
|
|
147
|
+
"panel.header": "検索と置換",
|
|
148
|
+
"panel.search_label": "検索:",
|
|
149
|
+
"panel.replace_label": "置換:",
|
|
150
|
+
"panel.regex": "(正規表現)",
|
|
151
|
+
"panel.no_matches": "一致するものが見つかりません",
|
|
152
|
+
"panel.results": "結果: {count}",
|
|
153
|
+
"panel.limited": "(最大 {max} 件)",
|
|
154
|
+
"panel.selected": "({selected} 件選択)",
|
|
155
|
+
"panel.help": "[スペース] 切替 [a] 全選択 [n] 全解除 [r] 置換 [RET] プレビュー [q] 閉じる"
|
|
156
|
+
},
|
|
157
|
+
"zh": {
|
|
158
|
+
"cmd.search_replace": "在项目中搜索和替换",
|
|
159
|
+
"cmd.search_replace_desc": "在所有 git 跟踪的文件中搜索和替换文本",
|
|
160
|
+
"status.ready": "搜索和替换插件已就绪",
|
|
161
|
+
"status.enter_pattern": "输入搜索模式...",
|
|
162
|
+
"status.no_matches": "未找到 \"{pattern}\" 的匹配项",
|
|
163
|
+
"status.found_matches": "找到 {count} 个匹配项",
|
|
164
|
+
"status.search_error": "搜索错误: {error}",
|
|
165
|
+
"status.cancelled_empty": "搜索已取消 - 空模式",
|
|
166
|
+
"status.cancelled": "搜索/替换已取消",
|
|
167
|
+
"status.no_selected": "没有选择要替换的项目",
|
|
168
|
+
"status.no_items_selected": "没有选择项目",
|
|
169
|
+
"status.selected_count": "已选择 {selected}/{total}",
|
|
170
|
+
"status.replacing": "正在替换 {count} 处...",
|
|
171
|
+
"status.replaced_with_errors": "已在 {files} 个文件中替换 ({errors} 个错误)",
|
|
172
|
+
"status.replaced": "已在 {files} 个文件中替换 {count} 处",
|
|
173
|
+
"status.closed": "搜索/替换已关闭",
|
|
174
|
+
"status.failed_open_panel": "无法打开搜索/替换面板",
|
|
175
|
+
"status.preview": "预览: {file}:{line}",
|
|
176
|
+
"prompt.search": "搜索 (在项目中): ",
|
|
177
|
+
"prompt.replace": "替换为: ",
|
|
178
|
+
"panel.header": "搜索和替换",
|
|
179
|
+
"panel.search_label": "搜索:",
|
|
180
|
+
"panel.replace_label": "替换:",
|
|
181
|
+
"panel.regex": "(正则表达式)",
|
|
182
|
+
"panel.no_matches": "未找到匹配项",
|
|
183
|
+
"panel.results": "结果: {count}",
|
|
184
|
+
"panel.limited": "(限制为 {max})",
|
|
185
|
+
"panel.selected": "(已选择 {selected})",
|
|
186
|
+
"panel.help": "[空格] 切换 [a] 全选 [n] 全不选 [r] 替换 [回车] 预览 [q] 关闭"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference path="../types/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Multi-File Search & Replace Plugin
|
|
@@ -97,15 +99,15 @@ function buildPanelEntries(): TextPropertyEntry[] {
|
|
|
97
99
|
// Header
|
|
98
100
|
const selectedCount = searchResults.filter(r => r.selected).length;
|
|
99
101
|
entries.push({
|
|
100
|
-
text: `═══
|
|
102
|
+
text: `═══ ${editor.t("panel.header")} ═══\n`,
|
|
101
103
|
properties: { type: "header" },
|
|
102
104
|
});
|
|
103
105
|
entries.push({
|
|
104
|
-
text:
|
|
106
|
+
text: `${editor.t("panel.search_label")} "${searchPattern}"${searchRegex ? " " + editor.t("panel.regex") : ""}\n`,
|
|
105
107
|
properties: { type: "info" },
|
|
106
108
|
});
|
|
107
109
|
entries.push({
|
|
108
|
-
text:
|
|
110
|
+
text: `${editor.t("panel.replace_label")} "${replaceText}"\n`,
|
|
109
111
|
properties: { type: "info" },
|
|
110
112
|
});
|
|
111
113
|
entries.push({
|
|
@@ -115,14 +117,14 @@ function buildPanelEntries(): TextPropertyEntry[] {
|
|
|
115
117
|
|
|
116
118
|
if (searchResults.length === 0) {
|
|
117
119
|
entries.push({
|
|
118
|
-
text: "
|
|
120
|
+
text: " " + editor.t("panel.no_matches") + "\n",
|
|
119
121
|
properties: { type: "empty" },
|
|
120
122
|
});
|
|
121
123
|
} else {
|
|
122
124
|
// Results header
|
|
123
|
-
const limitNote = searchResults.length >= MAX_RESULTS ?
|
|
125
|
+
const limitNote = searchResults.length >= MAX_RESULTS ? " " + editor.t("panel.limited", { max: String(MAX_RESULTS) }) : "";
|
|
124
126
|
entries.push({
|
|
125
|
-
text:
|
|
127
|
+
text: `${editor.t("panel.results", { count: String(searchResults.length) })}${limitNote} ${editor.t("panel.selected", { selected: String(selectedCount) })}\n`,
|
|
126
128
|
properties: { type: "count" },
|
|
127
129
|
});
|
|
128
130
|
entries.push({
|
|
@@ -154,7 +156,7 @@ function buildPanelEntries(): TextPropertyEntry[] {
|
|
|
154
156
|
properties: { type: "separator" },
|
|
155
157
|
});
|
|
156
158
|
entries.push({
|
|
157
|
-
text:
|
|
159
|
+
text: editor.t("panel.help") + "\n",
|
|
158
160
|
properties: { type: "help" },
|
|
159
161
|
});
|
|
160
162
|
|
|
@@ -202,12 +204,12 @@ async function performSearch(pattern: string, replace: string, isRegex: boolean)
|
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
if (searchResults.length === 0) {
|
|
205
|
-
editor.setStatus(
|
|
207
|
+
editor.setStatus(editor.t("status.no_matches", { pattern }));
|
|
206
208
|
} else {
|
|
207
|
-
editor.setStatus(
|
|
209
|
+
editor.setStatus(editor.t("status.found_matches", { count: String(searchResults.length) }));
|
|
208
210
|
}
|
|
209
211
|
} catch (e) {
|
|
210
|
-
editor.setStatus(
|
|
212
|
+
editor.setStatus(editor.t("status.search_error", { error: String(e) }));
|
|
211
213
|
searchResults = [];
|
|
212
214
|
}
|
|
213
215
|
}
|
|
@@ -239,7 +241,7 @@ async function showResultsPanel(): Promise<void> {
|
|
|
239
241
|
editor.debug(`Search/Replace panel opened with buffer ID ${resultsBufferId}`);
|
|
240
242
|
} catch (error) {
|
|
241
243
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
242
|
-
editor.setStatus("
|
|
244
|
+
editor.setStatus(editor.t("status.failed_open_panel"));
|
|
243
245
|
editor.debug(`ERROR: createVirtualBufferInSplit failed: ${errorMessage}`);
|
|
244
246
|
}
|
|
245
247
|
}
|
|
@@ -249,7 +251,7 @@ async function executeReplacements(): Promise<void> {
|
|
|
249
251
|
const selectedResults = searchResults.filter(r => r.selected);
|
|
250
252
|
|
|
251
253
|
if (selectedResults.length === 0) {
|
|
252
|
-
editor.setStatus("
|
|
254
|
+
editor.setStatus(editor.t("status.no_selected"));
|
|
253
255
|
return;
|
|
254
256
|
}
|
|
255
257
|
|
|
@@ -309,10 +311,10 @@ async function executeReplacements(): Promise<void> {
|
|
|
309
311
|
|
|
310
312
|
// Report results
|
|
311
313
|
if (errors.length > 0) {
|
|
312
|
-
editor.setStatus(
|
|
314
|
+
editor.setStatus(editor.t("status.replaced_with_errors", { files: String(filesModified), errors: String(errors.length) }));
|
|
313
315
|
editor.debug(`Replacement errors: ${errors.join(", ")}`);
|
|
314
316
|
} else {
|
|
315
|
-
editor.setStatus(
|
|
317
|
+
editor.setStatus(editor.t("status.replaced", { count: String(replacementsCount), files: String(filesModified) }));
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
// Close panel after replacement
|
|
@@ -325,8 +327,8 @@ globalThis.start_search_replace = function(): void {
|
|
|
325
327
|
searchPattern = "";
|
|
326
328
|
replaceText = "";
|
|
327
329
|
|
|
328
|
-
editor.startPrompt("
|
|
329
|
-
editor.setStatus("
|
|
330
|
+
editor.startPrompt(editor.t("prompt.search"), "search-replace-search");
|
|
331
|
+
editor.setStatus(editor.t("status.enter_pattern"));
|
|
330
332
|
};
|
|
331
333
|
|
|
332
334
|
// Handle search prompt confirmation
|
|
@@ -341,14 +343,14 @@ globalThis.onSearchReplaceSearchConfirmed = function(args: {
|
|
|
341
343
|
|
|
342
344
|
const pattern = args.input.trim();
|
|
343
345
|
if (!pattern) {
|
|
344
|
-
editor.setStatus("
|
|
346
|
+
editor.setStatus(editor.t("status.cancelled_empty"));
|
|
345
347
|
return true;
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
searchPattern = pattern;
|
|
349
351
|
|
|
350
352
|
// Ask for replacement text
|
|
351
|
-
editor.startPrompt("
|
|
353
|
+
editor.startPrompt(editor.t("prompt.replace"), "search-replace-replace");
|
|
352
354
|
return true;
|
|
353
355
|
};
|
|
354
356
|
|
|
@@ -380,7 +382,7 @@ globalThis.onSearchReplacePromptCancelled = function(args: {
|
|
|
380
382
|
return true;
|
|
381
383
|
}
|
|
382
384
|
|
|
383
|
-
editor.setStatus("
|
|
385
|
+
editor.setStatus(editor.t("status.cancelled"));
|
|
384
386
|
return true;
|
|
385
387
|
};
|
|
386
388
|
|
|
@@ -395,7 +397,7 @@ globalThis.search_replace_toggle_item = function(): void {
|
|
|
395
397
|
searchResults[index].selected = !searchResults[index].selected;
|
|
396
398
|
updatePanelContent();
|
|
397
399
|
const selected = searchResults.filter(r => r.selected).length;
|
|
398
|
-
editor.setStatus(
|
|
400
|
+
editor.setStatus(editor.t("status.selected_count", { selected: String(selected), total: String(searchResults.length) }));
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
403
|
};
|
|
@@ -406,7 +408,7 @@ globalThis.search_replace_select_all = function(): void {
|
|
|
406
408
|
result.selected = true;
|
|
407
409
|
}
|
|
408
410
|
updatePanelContent();
|
|
409
|
-
editor.setStatus(
|
|
411
|
+
editor.setStatus(editor.t("status.selected_count", { selected: String(searchResults.length), total: String(searchResults.length) }));
|
|
410
412
|
};
|
|
411
413
|
|
|
412
414
|
// Select no items
|
|
@@ -415,18 +417,18 @@ globalThis.search_replace_select_none = function(): void {
|
|
|
415
417
|
result.selected = false;
|
|
416
418
|
}
|
|
417
419
|
updatePanelContent();
|
|
418
|
-
editor.setStatus(
|
|
420
|
+
editor.setStatus(editor.t("status.selected_count", { selected: "0", total: String(searchResults.length) }));
|
|
419
421
|
};
|
|
420
422
|
|
|
421
423
|
// Execute replacement
|
|
422
424
|
globalThis.search_replace_execute = function(): void {
|
|
423
425
|
const selected = searchResults.filter(r => r.selected).length;
|
|
424
426
|
if (selected === 0) {
|
|
425
|
-
editor.setStatus("
|
|
427
|
+
editor.setStatus(editor.t("status.no_items_selected"));
|
|
426
428
|
return;
|
|
427
429
|
}
|
|
428
430
|
|
|
429
|
-
editor.setStatus(
|
|
431
|
+
editor.setStatus(editor.t("status.replacing", { count: String(selected) }));
|
|
430
432
|
executeReplacements();
|
|
431
433
|
};
|
|
432
434
|
|
|
@@ -439,7 +441,7 @@ globalThis.search_replace_preview = function(): void {
|
|
|
439
441
|
const location = props[0].location as { file: string; line: number; column: number } | undefined;
|
|
440
442
|
if (location) {
|
|
441
443
|
editor.openFileInSplit(sourceSplitId, location.file, location.line, location.column);
|
|
442
|
-
editor.setStatus(
|
|
444
|
+
editor.setStatus(editor.t("status.preview", { file: getRelativePath(location.file), line: String(location.line) }));
|
|
443
445
|
}
|
|
444
446
|
}
|
|
445
447
|
};
|
|
@@ -461,7 +463,7 @@ globalThis.search_replace_close = function(): void {
|
|
|
461
463
|
sourceSplitId = null;
|
|
462
464
|
resultsSplitId = null;
|
|
463
465
|
searchResults = [];
|
|
464
|
-
editor.setStatus("
|
|
466
|
+
editor.setStatus(editor.t("status.closed"));
|
|
465
467
|
};
|
|
466
468
|
|
|
467
469
|
// Register event handlers
|
|
@@ -471,12 +473,12 @@ editor.on("prompt_cancelled", "onSearchReplacePromptCancelled");
|
|
|
471
473
|
|
|
472
474
|
// Register command
|
|
473
475
|
editor.registerCommand(
|
|
474
|
-
"
|
|
475
|
-
"
|
|
476
|
+
"%cmd.search_replace",
|
|
477
|
+
"%cmd.search_replace_desc",
|
|
476
478
|
"start_search_replace",
|
|
477
479
|
"normal"
|
|
478
480
|
);
|
|
479
481
|
|
|
480
482
|
// Plugin initialization
|
|
481
483
|
editor.debug("Search & Replace plugin loaded");
|
|
482
|
-
editor.setStatus("
|
|
484
|
+
editor.setStatus(editor.t("status.ready"));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"cmd.test": "Test Localized Command",
|
|
4
|
+
"cmd.test_desc": "A command to test plugin localization",
|
|
5
|
+
"msg.hello": "Hello, %{name}! Your locale is %{locale}."
|
|
6
|
+
},
|
|
7
|
+
"es": {
|
|
8
|
+
"cmd.test": "Comando de prueba localizado",
|
|
9
|
+
"cmd.test_desc": "Un comando para probar la localización de plugins",
|
|
10
|
+
"msg.hello": "¡Hola, %{name}! Tu idioma es %{locale}."
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
globalThis.test_i18n_action = function() {
|
|
6
|
+
const locale = editor.getCurrentLocale();
|
|
7
|
+
const msg = editor.t("msg.hello", { name: "User", locale: locale });
|
|
8
|
+
editor.setStatus(msg);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
editor.registerCommand(
|
|
12
|
+
"%cmd.test",
|
|
13
|
+
"%cmd.test_desc",
|
|
14
|
+
"test_i18n_action",
|
|
15
|
+
"normal"
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
editor.setStatus("Test i18n plugin loaded");
|