@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
@@ -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: `═══ Search & Replace ═══\n`,
102
+ text: `═══ ${editor.t("panel.header")} ═══\n`,
101
103
  properties: { type: "header" },
102
104
  });
103
105
  entries.push({
104
- text: `Search: "${searchPattern}"${searchRegex ? " (regex)" : ""}\n`,
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: `Replace: "${replaceText}"\n`,
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: " No matches found\n",
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 ? ` (limited to ${MAX_RESULTS})` : "";
125
+ const limitNote = searchResults.length >= MAX_RESULTS ? " " + editor.t("panel.limited", { max: String(MAX_RESULTS) }) : "";
124
126
  entries.push({
125
- text: `Results: ${searchResults.length}${limitNote} (${selectedCount} selected)\n`,
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: `[SPC] toggle [a] all [n] none [r] REPLACE [RET] preview [q] close\n`,
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(`No matches found for "${pattern}"`);
207
+ editor.setStatus(editor.t("status.no_matches", { pattern }));
206
208
  } else {
207
- editor.setStatus(`Found ${searchResults.length} matches`);
209
+ editor.setStatus(editor.t("status.found_matches", { count: String(searchResults.length) }));
208
210
  }
209
211
  } catch (e) {
210
- editor.setStatus(`Search error: ${e}`);
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("Failed to open search/replace panel");
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("No items selected for replacement");
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(`Replaced in ${filesModified} files (${errors.length} errors)`);
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(`Replaced ${replacementsCount} occurrences in ${filesModified} files`);
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("Search (in project): ", "search-replace-search");
329
- editor.setStatus("Enter search pattern...");
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("Search cancelled - empty pattern");
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("Replace with: ", "search-replace-replace");
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("Search/Replace cancelled");
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(`${selected}/${searchResults.length} selected`);
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(`${searchResults.length}/${searchResults.length} selected`);
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(`0/${searchResults.length} selected`);
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("No items selected");
427
+ editor.setStatus(editor.t("status.no_items_selected"));
426
428
  return;
427
429
  }
428
430
 
429
- editor.setStatus(`Replacing ${selected} occurrences...`);
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(`Preview: ${getRelativePath(location.file)}:${location.line}`);
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("Search/Replace closed");
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
- "Search and Replace in Project",
475
- "Search and replace text across all git-tracked files",
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("Search & Replace plugin ready");
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");