@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.
- package/CHANGELOG.md +106 -0
- package/README.md +4 -2
- package/package.json +1 -1
- package/plugins/audit_mode.i18n.json +380 -0
- package/plugins/audit_mode.ts +1813 -0
- 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 +168 -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 +79 -141
- package/plugins/csharp-lsp.ts +147 -0
- package/plugins/csharp_support.i18n.json +38 -0
- package/plugins/csharp_support.ts +6 -4
- package/plugins/css-lsp.ts +143 -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 +143 -0
- package/plugins/html-lsp.ts +145 -0
- package/plugins/json-lsp.ts +145 -0
- package/plugins/lib/fresh.d.ts +150 -14
- 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 +162 -0
- package/plugins/rust-lsp.ts +166 -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 +167 -0
- package/plugins/vi_mode.i18n.json +716 -0
- package/plugins/vi_mode.ts +2747 -0
- package/plugins/welcome.i18n.json +110 -0
- package/plugins/welcome.ts +18 -16
|
@@ -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");
|