@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
|
@@ -33,7 +33,7 @@ export class NavigationController<T> {
|
|
|
33
33
|
private currentIndex: number = 0;
|
|
34
34
|
private options: NavigationOptions<T>;
|
|
35
35
|
|
|
36
|
-
constructor(options: NavigationOptions<T> = {}) {
|
|
36
|
+
constructor(private readonly editor: EditorAPI, options: NavigationOptions<T> = {}) {
|
|
37
37
|
this.options = {
|
|
38
38
|
itemLabel: "Item",
|
|
39
39
|
wrap: false,
|
|
@@ -168,13 +168,13 @@ export class NavigationController<T> {
|
|
|
168
168
|
*/
|
|
169
169
|
showStatus(customMessage?: string): void {
|
|
170
170
|
if (this.items.length === 0) {
|
|
171
|
-
editor.setStatus(`No ${this.options.itemLabel}s`);
|
|
171
|
+
this.editor.setStatus(`No ${this.options.itemLabel}s`);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
const message = customMessage ||
|
|
176
176
|
`${this.options.itemLabel} ${this.currentIndex + 1}/${this.items.length}`;
|
|
177
|
-
editor.setStatus(message);
|
|
177
|
+
this.editor.setStatus(message);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
/**
|
|
@@ -40,10 +40,12 @@ export class PanelManager {
|
|
|
40
40
|
/**
|
|
41
41
|
* Create a new PanelManager
|
|
42
42
|
*
|
|
43
|
+
* @param editor - The editor API instance
|
|
43
44
|
* @param panelName - Display name for the panel (e.g., "*Diagnostics*")
|
|
44
45
|
* @param modeName - Mode name for keybindings (e.g., "diagnostics-list")
|
|
45
46
|
*/
|
|
46
47
|
constructor(
|
|
48
|
+
private readonly editor: EditorAPI,
|
|
47
49
|
private readonly panelName: string,
|
|
48
50
|
private readonly modeName: string
|
|
49
51
|
) {}
|
|
@@ -101,11 +103,11 @@ export class PanelManager {
|
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
// Save current context
|
|
104
|
-
this.state.sourceSplitId = editor.getActiveSplitId();
|
|
105
|
-
this.state.sourceBufferId = editor.getActiveBufferId();
|
|
106
|
+
this.state.sourceSplitId = this.editor.getActiveSplitId();
|
|
107
|
+
this.state.sourceBufferId = this.editor.getActiveBufferId();
|
|
106
108
|
|
|
107
109
|
// Create virtual buffer in split
|
|
108
|
-
const bufferId = await editor.createVirtualBufferInSplit({
|
|
110
|
+
const bufferId = await this.editor.createVirtualBufferInSplit({
|
|
109
111
|
name: this.panelName,
|
|
110
112
|
mode: this.modeName,
|
|
111
113
|
read_only: true,
|
|
@@ -118,7 +120,7 @@ export class PanelManager {
|
|
|
118
120
|
|
|
119
121
|
// Track state
|
|
120
122
|
this.state.bufferId = bufferId;
|
|
121
|
-
this.state.splitId = editor.getActiveSplitId();
|
|
123
|
+
this.state.splitId = this.editor.getActiveSplitId();
|
|
122
124
|
this.state.isOpen = true;
|
|
123
125
|
|
|
124
126
|
return bufferId;
|
|
@@ -134,12 +136,12 @@ export class PanelManager {
|
|
|
134
136
|
|
|
135
137
|
// Close the split containing the panel
|
|
136
138
|
if (this.state.splitId !== null) {
|
|
137
|
-
editor.closeSplit(this.state.splitId);
|
|
139
|
+
this.editor.closeSplit(this.state.splitId);
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
// Focus back on source split
|
|
141
143
|
if (this.state.sourceSplitId !== null) {
|
|
142
|
-
editor.focusSplit(this.state.sourceSplitId);
|
|
144
|
+
this.editor.focusSplit(this.state.sourceSplitId);
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
// Reset state
|
|
@@ -156,7 +158,7 @@ export class PanelManager {
|
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
editor.setVirtualBufferContent(this.state.bufferId, entries);
|
|
161
|
+
this.editor.setVirtualBufferContent(this.state.bufferId, entries);
|
|
160
162
|
}
|
|
161
163
|
|
|
162
164
|
/**
|
|
@@ -177,7 +179,7 @@ export class PanelManager {
|
|
|
177
179
|
*/
|
|
178
180
|
focusSource(): void {
|
|
179
181
|
if (this.state.sourceSplitId !== null) {
|
|
180
|
-
editor.focusSplit(this.state.sourceSplitId);
|
|
182
|
+
this.editor.focusSplit(this.state.sourceSplitId);
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
|
|
@@ -186,7 +188,7 @@ export class PanelManager {
|
|
|
186
188
|
*/
|
|
187
189
|
focusPanel(): void {
|
|
188
190
|
if (this.state.splitId !== null) {
|
|
189
|
-
editor.focusSplit(this.state.splitId);
|
|
191
|
+
this.editor.focusSplit(this.state.splitId);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
194
|
|
|
@@ -203,13 +205,13 @@ export class PanelManager {
|
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
// Focus source split and open file
|
|
206
|
-
editor.focusSplit(this.state.sourceSplitId);
|
|
207
|
-
await editor.openFile(filePath);
|
|
208
|
+
this.editor.focusSplit(this.state.sourceSplitId);
|
|
209
|
+
await this.editor.openFile(filePath);
|
|
208
210
|
|
|
209
211
|
// Jump to location
|
|
210
|
-
editor.gotoLine(line);
|
|
212
|
+
this.editor.gotoLine(line);
|
|
211
213
|
if (column > 1) {
|
|
212
|
-
editor.gotoColumn(column);
|
|
214
|
+
this.editor.gotoColumn(column);
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
// Focus back on panel
|
|
@@ -29,130 +29,102 @@ export interface SplitBufferOptions extends VirtualBufferOptions {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* VirtualBufferFactory
|
|
33
|
-
*
|
|
34
|
-
* Provides convenience methods for creating virtual buffers with
|
|
35
|
-
* sensible defaults for read-only panel views.
|
|
32
|
+
* Create a VirtualBufferFactory bound to a specific editor instance.
|
|
36
33
|
*
|
|
37
34
|
* @example
|
|
38
35
|
* ```typescript
|
|
39
|
-
*
|
|
40
|
-
* const
|
|
36
|
+
* const editor = getEditor();
|
|
37
|
+
* const bufferFactory = createVirtualBufferFactory(editor);
|
|
38
|
+
*
|
|
39
|
+
* // Create buffer as a tab in current split
|
|
40
|
+
* const bufferId = await bufferFactory.create({
|
|
41
41
|
* name: "*Help*",
|
|
42
42
|
* mode: "help-manual",
|
|
43
43
|
* entries: helpEntries,
|
|
44
44
|
* });
|
|
45
|
-
*
|
|
46
|
-
* // Create buffer in existing split (e.g., commit detail view)
|
|
47
|
-
* const bufferId = await VirtualBufferFactory.createInSplit(splitId, {
|
|
48
|
-
* name: "*Commit Details*",
|
|
49
|
-
* mode: "git-commit-detail",
|
|
50
|
-
* entries: detailEntries,
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* // Create buffer in new split
|
|
54
|
-
* const bufferId = await VirtualBufferFactory.createWithSplit({
|
|
55
|
-
* name: "*References*",
|
|
56
|
-
* mode: "references-list",
|
|
57
|
-
* entries: refEntries,
|
|
58
|
-
* ratio: 0.4,
|
|
59
|
-
* });
|
|
60
45
|
* ```
|
|
61
46
|
*/
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
showLineNumbers = false,
|
|
77
|
-
editingDisabled = true,
|
|
78
|
-
readOnly = true,
|
|
79
|
-
} = options;
|
|
47
|
+
export function createVirtualBufferFactory(editor: EditorAPI) {
|
|
48
|
+
return {
|
|
49
|
+
/**
|
|
50
|
+
* Create a virtual buffer as a new tab in the current split
|
|
51
|
+
*/
|
|
52
|
+
async create(options: VirtualBufferOptions): Promise<number> {
|
|
53
|
+
const {
|
|
54
|
+
name,
|
|
55
|
+
mode,
|
|
56
|
+
entries,
|
|
57
|
+
showLineNumbers = false,
|
|
58
|
+
editingDisabled = true,
|
|
59
|
+
readOnly = true,
|
|
60
|
+
} = options;
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
62
|
+
return await editor.createVirtualBuffer({
|
|
63
|
+
name,
|
|
64
|
+
mode,
|
|
65
|
+
read_only: readOnly,
|
|
66
|
+
entries,
|
|
67
|
+
show_line_numbers: showLineNumbers,
|
|
68
|
+
editing_disabled: editingDisabled,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
90
71
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
showLineNumbers = false,
|
|
104
|
-
editingDisabled = true,
|
|
105
|
-
readOnly = true,
|
|
106
|
-
} = options;
|
|
72
|
+
/**
|
|
73
|
+
* Create a virtual buffer in an existing split
|
|
74
|
+
*/
|
|
75
|
+
async createInSplit(splitId: number, options: VirtualBufferOptions): Promise<number> {
|
|
76
|
+
const {
|
|
77
|
+
name,
|
|
78
|
+
mode,
|
|
79
|
+
entries,
|
|
80
|
+
showLineNumbers = false,
|
|
81
|
+
editingDisabled = true,
|
|
82
|
+
readOnly = true,
|
|
83
|
+
} = options;
|
|
107
84
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
85
|
+
return await editor.createVirtualBufferInExistingSplit({
|
|
86
|
+
name,
|
|
87
|
+
mode,
|
|
88
|
+
read_only: readOnly,
|
|
89
|
+
entries,
|
|
90
|
+
split_id: splitId,
|
|
91
|
+
show_line_numbers: showLineNumbers,
|
|
92
|
+
editing_disabled: editingDisabled,
|
|
93
|
+
});
|
|
94
|
+
},
|
|
118
95
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
editingDisabled = true,
|
|
134
|
-
readOnly = true,
|
|
135
|
-
} = options;
|
|
96
|
+
/**
|
|
97
|
+
* Create a virtual buffer in a new split
|
|
98
|
+
*/
|
|
99
|
+
async createWithSplit(options: SplitBufferOptions): Promise<number> {
|
|
100
|
+
const {
|
|
101
|
+
name,
|
|
102
|
+
mode,
|
|
103
|
+
entries,
|
|
104
|
+
ratio = 0.3,
|
|
105
|
+
panelId,
|
|
106
|
+
showLineNumbers = false,
|
|
107
|
+
editingDisabled = true,
|
|
108
|
+
readOnly = true,
|
|
109
|
+
} = options;
|
|
136
110
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
111
|
+
return await editor.createVirtualBufferInSplit({
|
|
112
|
+
name,
|
|
113
|
+
mode,
|
|
114
|
+
read_only: readOnly,
|
|
115
|
+
entries,
|
|
116
|
+
ratio,
|
|
117
|
+
panel_id: panelId,
|
|
118
|
+
show_line_numbers: showLineNumbers,
|
|
119
|
+
editing_disabled: editingDisabled,
|
|
120
|
+
});
|
|
121
|
+
},
|
|
148
122
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
};
|
|
123
|
+
/**
|
|
124
|
+
* Update content of an existing virtual buffer
|
|
125
|
+
*/
|
|
126
|
+
updateContent(bufferId: number, entries: TextPropertyEntry[]): void {
|
|
127
|
+
editor.setVirtualBufferContent(bufferId, entries);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"cmd.live_grep": "Live Grep (Find in Files)",
|
|
4
|
+
"cmd.live_grep_desc": "Search for text across project with live preview",
|
|
5
|
+
"status.ready": "Live Grep ready - use command palette or bind 'start_live_grep'",
|
|
6
|
+
"status.type_to_search": "Type to search (min 2 chars)...",
|
|
7
|
+
"status.found_matches": "Found {count} matches",
|
|
8
|
+
"status.no_matches": "No matches found",
|
|
9
|
+
"status.search_error": "Search error: {error}",
|
|
10
|
+
"status.opened_file": "Opened {file}:{line}",
|
|
11
|
+
"status.no_file_selected": "No file selected",
|
|
12
|
+
"status.cancelled": "Live grep cancelled",
|
|
13
|
+
"prompt.live_grep": "Live grep: "
|
|
14
|
+
},
|
|
15
|
+
"es": {
|
|
16
|
+
"cmd.live_grep": "Grep en Vivo (Buscar en Archivos)",
|
|
17
|
+
"cmd.live_grep_desc": "Buscar texto en todo el proyecto con vista previa en vivo",
|
|
18
|
+
"status.ready": "Grep en Vivo listo - usa la paleta de comandos o asigna 'start_live_grep'",
|
|
19
|
+
"status.type_to_search": "Escribe para buscar (min 2 caracteres)...",
|
|
20
|
+
"status.found_matches": "Se encontraron {count} coincidencias",
|
|
21
|
+
"status.no_matches": "No se encontraron coincidencias",
|
|
22
|
+
"status.search_error": "Error de búsqueda: {error}",
|
|
23
|
+
"status.opened_file": "Abierto {file}:{line}",
|
|
24
|
+
"status.no_file_selected": "Ningún archivo seleccionado",
|
|
25
|
+
"status.cancelled": "Grep en vivo cancelado",
|
|
26
|
+
"prompt.live_grep": "Grep en vivo: "
|
|
27
|
+
},
|
|
28
|
+
"de": {
|
|
29
|
+
"cmd.live_grep": "Live Grep (Suche in Dateien)",
|
|
30
|
+
"cmd.live_grep_desc": "Text im gesamten Projekt mit Live-Vorschau suchen",
|
|
31
|
+
"status.ready": "Live Grep bereit - Befehlspalette verwenden oder 'start_live_grep' binden",
|
|
32
|
+
"status.type_to_search": "Tippen zum Suchen (min. 2 Zeichen)...",
|
|
33
|
+
"status.found_matches": "{count} Treffer gefunden",
|
|
34
|
+
"status.no_matches": "Keine Treffer gefunden",
|
|
35
|
+
"status.search_error": "Suchfehler: {error}",
|
|
36
|
+
"status.opened_file": "{file}:{line} geöffnet",
|
|
37
|
+
"status.no_file_selected": "Keine Datei ausgewählt",
|
|
38
|
+
"status.cancelled": "Live Grep abgebrochen",
|
|
39
|
+
"prompt.live_grep": "Live Grep: "
|
|
40
|
+
},
|
|
41
|
+
"fr": {
|
|
42
|
+
"cmd.live_grep": "Grep en Direct (Rechercher dans les Fichiers)",
|
|
43
|
+
"cmd.live_grep_desc": "Rechercher du texte dans tout le projet avec aperçu en direct",
|
|
44
|
+
"status.ready": "Grep en Direct prêt - utilisez la palette de commandes ou liez 'start_live_grep'",
|
|
45
|
+
"status.type_to_search": "Tapez pour rechercher (min 2 caractères)...",
|
|
46
|
+
"status.found_matches": "{count} correspondances trouvées",
|
|
47
|
+
"status.no_matches": "Aucune correspondance trouvée",
|
|
48
|
+
"status.search_error": "Erreur de recherche : {error}",
|
|
49
|
+
"status.opened_file": "Ouvert {file}:{line}",
|
|
50
|
+
"status.no_file_selected": "Aucun fichier sélectionné",
|
|
51
|
+
"status.cancelled": "Grep en direct annulé",
|
|
52
|
+
"prompt.live_grep": "Grep en direct : "
|
|
53
|
+
},
|
|
54
|
+
"ja": {
|
|
55
|
+
"cmd.live_grep": "ライブ Grep (ファイル内検索)",
|
|
56
|
+
"cmd.live_grep_desc": "プロジェクト全体をライブプレビュー付きで検索",
|
|
57
|
+
"status.ready": "ライブ Grep 準備完了 - コマンドパレットを使用するか 'start_live_grep' をバインド",
|
|
58
|
+
"status.type_to_search": "検索するには入力してください (最小2文字)...",
|
|
59
|
+
"status.found_matches": "{count} 件の一致が見つかりました",
|
|
60
|
+
"status.no_matches": "一致するものが見つかりません",
|
|
61
|
+
"status.search_error": "検索エラー: {error}",
|
|
62
|
+
"status.opened_file": "{file}:{line} を開きました",
|
|
63
|
+
"status.no_file_selected": "ファイルが選択されていません",
|
|
64
|
+
"status.cancelled": "ライブ grep がキャンセルされました",
|
|
65
|
+
"prompt.live_grep": "ライブ grep: "
|
|
66
|
+
},
|
|
67
|
+
"zh": {
|
|
68
|
+
"cmd.live_grep": "实时 Grep (文件内搜索)",
|
|
69
|
+
"cmd.live_grep_desc": "在整个项目中搜索文本并实时预览",
|
|
70
|
+
"status.ready": "实时 Grep 已就绪 - 使用命令面板或绑定 'start_live_grep'",
|
|
71
|
+
"status.type_to_search": "输入以搜索 (最少2个字符)...",
|
|
72
|
+
"status.found_matches": "找到 {count} 个匹配项",
|
|
73
|
+
"status.no_matches": "未找到匹配项",
|
|
74
|
+
"status.search_error": "搜索错误: {error}",
|
|
75
|
+
"status.opened_file": "已打开 {file}:{line}",
|
|
76
|
+
"status.no_file_selected": "未选择文件",
|
|
77
|
+
"status.cancelled": "实时 grep 已取消",
|
|
78
|
+
"prompt.live_grep": "实时 grep: "
|
|
79
|
+
}
|
|
80
|
+
}
|
package/plugins/live_grep.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference path="./lib/fresh.d.ts" />
|
|
2
|
+
const editor = getEditor();
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Live Grep Plugin
|
|
@@ -264,31 +266,31 @@ async function runSearch(query: string): Promise<void> {
|
|
|
264
266
|
editor.setPromptSuggestions(suggestions);
|
|
265
267
|
|
|
266
268
|
if (results.length > 0) {
|
|
267
|
-
editor.setStatus(
|
|
269
|
+
editor.setStatus(editor.t("status.found_matches", { count: String(results.length) }));
|
|
268
270
|
// Show preview of first result
|
|
269
271
|
await updatePreview(results[0]);
|
|
270
272
|
} else {
|
|
271
|
-
editor.setStatus("
|
|
273
|
+
editor.setStatus(editor.t("status.no_matches"));
|
|
272
274
|
}
|
|
273
275
|
} else if (result.exit_code === 1) {
|
|
274
276
|
// No matches
|
|
275
277
|
editor.debug(`[live_grep] no matches (exit_code=1)`);
|
|
276
278
|
grepResults = [];
|
|
277
279
|
editor.setPromptSuggestions([]);
|
|
278
|
-
editor.setStatus("
|
|
280
|
+
editor.setStatus(editor.t("status.no_matches"));
|
|
279
281
|
} else if (result.exit_code === -1) {
|
|
280
282
|
// Process was killed, ignore
|
|
281
283
|
editor.debug(`[live_grep] process was killed`);
|
|
282
284
|
} else {
|
|
283
285
|
editor.debug(`[live_grep] search error: ${result.stderr}`);
|
|
284
|
-
editor.setStatus(
|
|
286
|
+
editor.setStatus(editor.t("status.search_error", { error: result.stderr }));
|
|
285
287
|
}
|
|
286
288
|
} catch (e) {
|
|
287
289
|
// Ignore errors from killed processes
|
|
288
290
|
const errorMsg = String(e);
|
|
289
291
|
editor.debug(`[live_grep] caught error: ${errorMsg}`);
|
|
290
292
|
if (!errorMsg.includes("killed") && !errorMsg.includes("not found")) {
|
|
291
|
-
editor.setStatus(
|
|
293
|
+
editor.setStatus(editor.t("status.search_error", { error: String(e) }));
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
296
|
}
|
|
@@ -304,8 +306,8 @@ globalThis.start_live_grep = function (): void {
|
|
|
304
306
|
originalSplitId = editor.getActiveSplitId();
|
|
305
307
|
|
|
306
308
|
// Start the prompt
|
|
307
|
-
editor.startPrompt("
|
|
308
|
-
editor.setStatus(
|
|
309
|
+
editor.startPrompt(editor.t("prompt.live_grep"), "live-grep");
|
|
310
|
+
editor.setStatus(editor.t("status.type_to_search"));
|
|
309
311
|
};
|
|
310
312
|
|
|
311
313
|
// Handle prompt input changes
|
|
@@ -365,9 +367,9 @@ globalThis.onLiveGrepPromptConfirmed = function (args: {
|
|
|
365
367
|
if (args.selected_index !== null && grepResults[args.selected_index]) {
|
|
366
368
|
const selected = grepResults[args.selected_index];
|
|
367
369
|
editor.openFile(selected.file, selected.line, selected.column);
|
|
368
|
-
editor.setStatus(
|
|
370
|
+
editor.setStatus(editor.t("status.opened_file", { file: selected.file, line: String(selected.line) }));
|
|
369
371
|
} else {
|
|
370
|
-
editor.setStatus("
|
|
372
|
+
editor.setStatus(editor.t("status.no_file_selected"));
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
// Clear state
|
|
@@ -397,7 +399,7 @@ globalThis.onLiveGrepPromptCancelled = function (args: {
|
|
|
397
399
|
grepResults = [];
|
|
398
400
|
originalSplitId = null;
|
|
399
401
|
previewSplitId = null;
|
|
400
|
-
editor.setStatus("
|
|
402
|
+
editor.setStatus(editor.t("status.cancelled"));
|
|
401
403
|
|
|
402
404
|
return true;
|
|
403
405
|
};
|
|
@@ -410,11 +412,11 @@ editor.on("prompt_cancelled", "onLiveGrepPromptCancelled");
|
|
|
410
412
|
|
|
411
413
|
// Register command
|
|
412
414
|
editor.registerCommand(
|
|
413
|
-
"
|
|
414
|
-
"
|
|
415
|
+
"%cmd.live_grep",
|
|
416
|
+
"%cmd.live_grep_desc",
|
|
415
417
|
"start_live_grep",
|
|
416
418
|
"normal"
|
|
417
419
|
);
|
|
418
420
|
|
|
419
421
|
editor.debug("Live Grep plugin loaded");
|
|
420
|
-
editor.setStatus("
|
|
422
|
+
editor.setStatus(editor.t("status.ready"));
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"cmd.toggle_compose": "Markdown: Toggle Compose",
|
|
4
|
+
"cmd.toggle_compose_desc": "Toggle compose mode (soft wrapping, centered margins)",
|
|
5
|
+
"cmd.set_compose_width": "Markdown: Set Compose Width",
|
|
6
|
+
"cmd.set_compose_width_desc": "Set the width for compose mode wrapping and margins",
|
|
7
|
+
"status.plugin_ready": "Markdown plugin ready",
|
|
8
|
+
"status.not_markdown_file": "Not a Markdown file",
|
|
9
|
+
"status.compose_off": "Markdown Compose: OFF",
|
|
10
|
+
"status.compose_on": "Markdown Compose: ON (soft breaks, centered)",
|
|
11
|
+
"status.width_set": "Markdown compose width set to {width}",
|
|
12
|
+
"status.invalid_width": "Invalid width - must be between 20 and 300",
|
|
13
|
+
"prompt.compose_width": "Compose width: ",
|
|
14
|
+
"suggestion.narrow": "Narrow - good for side panels",
|
|
15
|
+
"suggestion.classic": "Classic - traditional terminal width",
|
|
16
|
+
"suggestion.standard": "Standard - default width",
|
|
17
|
+
"suggestion.wide": "Wide - more content per line"
|
|
18
|
+
},
|
|
19
|
+
"es": {
|
|
20
|
+
"cmd.toggle_compose": "Markdown: Alternar Composicion",
|
|
21
|
+
"cmd.toggle_compose_desc": "Alternar modo de composicion (ajuste suave, margenes centrados)",
|
|
22
|
+
"cmd.set_compose_width": "Markdown: Establecer Ancho de Composicion",
|
|
23
|
+
"cmd.set_compose_width_desc": "Establecer el ancho para el ajuste y margenes del modo de composicion",
|
|
24
|
+
"status.plugin_ready": "Plugin Markdown listo",
|
|
25
|
+
"status.not_markdown_file": "No es un archivo Markdown",
|
|
26
|
+
"status.compose_off": "Composicion Markdown: DESACTIVADA",
|
|
27
|
+
"status.compose_on": "Composicion Markdown: ACTIVADA (saltos suaves, centrado)",
|
|
28
|
+
"status.width_set": "Ancho de composicion Markdown establecido en {width}",
|
|
29
|
+
"status.invalid_width": "Ancho invalido - debe estar entre 20 y 300",
|
|
30
|
+
"prompt.compose_width": "Ancho de composicion: ",
|
|
31
|
+
"suggestion.narrow": "Estrecho - bueno para paneles laterales",
|
|
32
|
+
"suggestion.classic": "Clasico - ancho de terminal tradicional",
|
|
33
|
+
"suggestion.standard": "Estandar - ancho predeterminado",
|
|
34
|
+
"suggestion.wide": "Amplio - mas contenido por linea"
|
|
35
|
+
},
|
|
36
|
+
"de": {
|
|
37
|
+
"cmd.toggle_compose": "Markdown: Kompositionsmodus umschalten",
|
|
38
|
+
"cmd.toggle_compose_desc": "Kompositionsmodus umschalten (weicher Umbruch, zentrierte Rander)",
|
|
39
|
+
"cmd.set_compose_width": "Markdown: Kompositionsbreite festlegen",
|
|
40
|
+
"cmd.set_compose_width_desc": "Breite fur Umbruch und Rander im Kompositionsmodus festlegen",
|
|
41
|
+
"status.plugin_ready": "Markdown-Plugin bereit",
|
|
42
|
+
"status.not_markdown_file": "Keine Markdown-Datei",
|
|
43
|
+
"status.compose_off": "Markdown-Komposition: AUS",
|
|
44
|
+
"status.compose_on": "Markdown-Komposition: AN (weiche Umbruche, zentriert)",
|
|
45
|
+
"status.width_set": "Markdown-Kompositionsbreite auf {width} gesetzt",
|
|
46
|
+
"status.invalid_width": "Ungultige Breite - muss zwischen 20 und 300 liegen",
|
|
47
|
+
"prompt.compose_width": "Kompositionsbreite: ",
|
|
48
|
+
"suggestion.narrow": "Schmal - gut fur Seitenpanels",
|
|
49
|
+
"suggestion.classic": "Klassisch - traditionelle Terminalbreite",
|
|
50
|
+
"suggestion.standard": "Standard - Standardbreite",
|
|
51
|
+
"suggestion.wide": "Breit - mehr Inhalt pro Zeile"
|
|
52
|
+
},
|
|
53
|
+
"fr": {
|
|
54
|
+
"cmd.toggle_compose": "Markdown: Basculer la Composition",
|
|
55
|
+
"cmd.toggle_compose_desc": "Basculer le mode composition (retour a la ligne souple, marges centrees)",
|
|
56
|
+
"cmd.set_compose_width": "Markdown: Definir la Largeur de Composition",
|
|
57
|
+
"cmd.set_compose_width_desc": "Definir la largeur pour le retour a la ligne et les marges du mode composition",
|
|
58
|
+
"status.plugin_ready": "Plugin Markdown pret",
|
|
59
|
+
"status.not_markdown_file": "Ce n'est pas un fichier Markdown",
|
|
60
|
+
"status.compose_off": "Composition Markdown: DESACTIVEE",
|
|
61
|
+
"status.compose_on": "Composition Markdown: ACTIVEE (sauts souples, centre)",
|
|
62
|
+
"status.width_set": "Largeur de composition Markdown definie a {width}",
|
|
63
|
+
"status.invalid_width": "Largeur invalide - doit etre entre 20 et 300",
|
|
64
|
+
"prompt.compose_width": "Largeur de composition: ",
|
|
65
|
+
"suggestion.narrow": "Etroit - bon pour les panneaux lateraux",
|
|
66
|
+
"suggestion.classic": "Classique - largeur de terminal traditionnelle",
|
|
67
|
+
"suggestion.standard": "Standard - largeur par defaut",
|
|
68
|
+
"suggestion.wide": "Large - plus de contenu par ligne"
|
|
69
|
+
},
|
|
70
|
+
"ja": {
|
|
71
|
+
"cmd.toggle_compose": "Markdown: 作成モード切り替え",
|
|
72
|
+
"cmd.toggle_compose_desc": "作成モードを切り替え(ソフトラップ、中央揃えマージン)",
|
|
73
|
+
"cmd.set_compose_width": "Markdown: 作成幅を設定",
|
|
74
|
+
"cmd.set_compose_width_desc": "作成モードの折り返しとマージンの幅を設定",
|
|
75
|
+
"status.plugin_ready": "Markdownプラグイン準備完了",
|
|
76
|
+
"status.not_markdown_file": "Markdownファイルではありません",
|
|
77
|
+
"status.compose_off": "Markdown作成: オフ",
|
|
78
|
+
"status.compose_on": "Markdown作成: オン(ソフト改行、中央揃え)",
|
|
79
|
+
"status.width_set": "Markdown作成幅を{width}に設定しました",
|
|
80
|
+
"status.invalid_width": "無効な幅 - 20から300の間である必要があります",
|
|
81
|
+
"prompt.compose_width": "作成幅: ",
|
|
82
|
+
"suggestion.narrow": "狭い - サイドパネルに最適",
|
|
83
|
+
"suggestion.classic": "クラシック - 従来のターミナル幅",
|
|
84
|
+
"suggestion.standard": "標準 - デフォルト幅",
|
|
85
|
+
"suggestion.wide": "広い - 1行あたりのコンテンツが増加"
|
|
86
|
+
},
|
|
87
|
+
"zh": {
|
|
88
|
+
"cmd.toggle_compose": "Markdown: 切换撰写模式",
|
|
89
|
+
"cmd.toggle_compose_desc": "切换撰写模式(软换行,居中边距)",
|
|
90
|
+
"cmd.set_compose_width": "Markdown: 设置撰写宽度",
|
|
91
|
+
"cmd.set_compose_width_desc": "设置撰写模式的换行和边距宽度",
|
|
92
|
+
"status.plugin_ready": "Markdown插件就绪",
|
|
93
|
+
"status.not_markdown_file": "不是Markdown文件",
|
|
94
|
+
"status.compose_off": "Markdown撰写: 关闭",
|
|
95
|
+
"status.compose_on": "Markdown撰写: 开启(软换行,居中)",
|
|
96
|
+
"status.width_set": "Markdown撰写宽度已设置为{width}",
|
|
97
|
+
"status.invalid_width": "无效宽度 - 必须在20到300之间",
|
|
98
|
+
"prompt.compose_width": "撰写宽度: ",
|
|
99
|
+
"suggestion.narrow": "窄 - 适合侧边面板",
|
|
100
|
+
"suggestion.classic": "经典 - 传统终端宽度",
|
|
101
|
+
"suggestion.standard": "标准 - 默认宽度",
|
|
102
|
+
"suggestion.wide": "宽 - 每行更多内容"
|
|
103
|
+
}
|
|
104
|
+
}
|