@fresh-editor/fresh-editor 0.1.86 → 0.1.87
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 +19 -0
- package/README.md +4 -0
- package/package.json +1 -1
- package/plugins/README.md +1 -0
- package/plugins/audit_mode.ts +38 -34
- package/plugins/calculator.ts +6 -6
- package/plugins/examples/virtual_buffer_demo.ts +4 -4
- package/plugins/git_blame.ts +3 -3
- package/plugins/git_explorer.ts +3 -2
- package/plugins/git_log.ts +10 -10
- package/plugins/java-lsp.ts +65 -0
- package/plugins/latex-lsp.ts +65 -0
- package/plugins/lib/finder.ts +32 -32
- package/plugins/lib/fresh.d.ts +430 -18
- package/plugins/lib/panel-manager.ts +7 -7
- package/plugins/lib/search-utils.ts +13 -13
- package/plugins/lib/virtual-buffer-factory.ts +16 -14
- package/plugins/markdown_compose.ts +4 -4
- package/plugins/marksman-lsp.ts +65 -0
- package/plugins/merge_conflict.ts +21 -21
- package/plugins/search_replace.ts +6 -6
- package/plugins/templ-lsp.ts +65 -0
- package/plugins/theme_editor.ts +6 -5
- package/plugins/vi_mode.ts +2 -2
- package/plugins/zig-lsp.ts +65 -0
package/plugins/lib/finder.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface DisplayEntry {
|
|
|
61
61
|
export interface SearchSource<T> {
|
|
62
62
|
mode: "search";
|
|
63
63
|
/** Function that returns a ProcessHandle or Promise of results */
|
|
64
|
-
search: (query: string) => ProcessHandle | Promise<T[]>;
|
|
64
|
+
search: (query: string) => ProcessHandle<SpawnResult> | Promise<T[]>;
|
|
65
65
|
/** Debounce delay in ms (default: 150) */
|
|
66
66
|
debounceMs?: number;
|
|
67
67
|
/** Minimum query length to trigger search (default: 2) */
|
|
@@ -328,7 +328,7 @@ interface PromptState<T> {
|
|
|
328
328
|
entries: DisplayEntry[];
|
|
329
329
|
lastQuery: string;
|
|
330
330
|
searchVersion: number;
|
|
331
|
-
currentSearch: ProcessHandle | null;
|
|
331
|
+
currentSearch: ProcessHandle<SpawnResult> | null;
|
|
332
332
|
pendingKill: Promise<boolean> | null;
|
|
333
333
|
originalSplitId: number | null;
|
|
334
334
|
}
|
|
@@ -927,17 +927,17 @@ export class Finder<T> {
|
|
|
927
927
|
const result = await this.editor.createVirtualBufferInSplit({
|
|
928
928
|
name: "*Preview*",
|
|
929
929
|
mode: this.previewModeName,
|
|
930
|
-
|
|
930
|
+
readOnly: true,
|
|
931
931
|
entries,
|
|
932
932
|
ratio: 0.5,
|
|
933
933
|
direction: "vertical",
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
934
|
+
panelId: `${this.config.id}-preview`,
|
|
935
|
+
showLineNumbers: false,
|
|
936
|
+
editingDisabled: true,
|
|
937
937
|
});
|
|
938
938
|
|
|
939
|
-
this.previewState.bufferId = result.
|
|
940
|
-
this.previewState.splitId = result.
|
|
939
|
+
this.previewState.bufferId = result.bufferId;
|
|
940
|
+
this.previewState.splitId = result.splitId ?? null;
|
|
941
941
|
|
|
942
942
|
// Return focus to original split
|
|
943
943
|
if (this.promptState.originalSplitId !== null) {
|
|
@@ -1066,19 +1066,19 @@ export class Finder<T> {
|
|
|
1066
1066
|
const result = await this.editor.createVirtualBufferInSplit({
|
|
1067
1067
|
name: `*${this.config.id.charAt(0).toUpperCase() + this.config.id.slice(1)}*`,
|
|
1068
1068
|
mode: this.modeName,
|
|
1069
|
-
|
|
1069
|
+
readOnly: true,
|
|
1070
1070
|
entries,
|
|
1071
1071
|
ratio,
|
|
1072
1072
|
direction: "horizontal",
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1073
|
+
panelId: this.config.id,
|
|
1074
|
+
showLineNumbers: false,
|
|
1075
|
+
showCursors: true,
|
|
1076
|
+
editingDisabled: true,
|
|
1077
1077
|
});
|
|
1078
1078
|
|
|
1079
|
-
if (result.
|
|
1080
|
-
this.panelState.bufferId = result.
|
|
1081
|
-
this.panelState.splitId = result.
|
|
1079
|
+
if (result.bufferId !== null) {
|
|
1080
|
+
this.panelState.bufferId = result.bufferId;
|
|
1081
|
+
this.panelState.splitId = result.splitId ?? null;
|
|
1082
1082
|
this.applyPanelHighlighting();
|
|
1083
1083
|
|
|
1084
1084
|
const count = this.panelState.items.length;
|
|
@@ -1343,12 +1343,12 @@ export class Finder<T> {
|
|
|
1343
1343
|
colors.selected[0],
|
|
1344
1344
|
colors.selected[1],
|
|
1345
1345
|
colors.selected[2],
|
|
1346
|
-
-1,
|
|
1347
|
-
-1,
|
|
1348
|
-
-1,
|
|
1349
1346
|
false,
|
|
1350
|
-
true,
|
|
1351
1347
|
false,
|
|
1348
|
+
false,
|
|
1349
|
+
undefined,
|
|
1350
|
+
undefined,
|
|
1351
|
+
undefined,
|
|
1352
1352
|
true
|
|
1353
1353
|
);
|
|
1354
1354
|
}
|
|
@@ -1363,12 +1363,12 @@ export class Finder<T> {
|
|
|
1363
1363
|
colors.title[0],
|
|
1364
1364
|
colors.title[1],
|
|
1365
1365
|
colors.title[2],
|
|
1366
|
-
-1,
|
|
1367
|
-
-1,
|
|
1368
|
-
-1,
|
|
1369
1366
|
false,
|
|
1370
1367
|
true,
|
|
1371
1368
|
false,
|
|
1369
|
+
undefined,
|
|
1370
|
+
undefined,
|
|
1371
|
+
undefined,
|
|
1372
1372
|
false
|
|
1373
1373
|
);
|
|
1374
1374
|
}
|
|
@@ -1383,12 +1383,12 @@ export class Finder<T> {
|
|
|
1383
1383
|
colors.fileHeader[0],
|
|
1384
1384
|
colors.fileHeader[1],
|
|
1385
1385
|
colors.fileHeader[2],
|
|
1386
|
-
-1,
|
|
1387
|
-
-1,
|
|
1388
|
-
-1,
|
|
1389
1386
|
false,
|
|
1390
1387
|
true,
|
|
1391
1388
|
false,
|
|
1389
|
+
undefined,
|
|
1390
|
+
undefined,
|
|
1391
|
+
undefined,
|
|
1392
1392
|
false
|
|
1393
1393
|
);
|
|
1394
1394
|
}
|
|
@@ -1423,12 +1423,12 @@ export class Finder<T> {
|
|
|
1423
1423
|
color[0],
|
|
1424
1424
|
color[1],
|
|
1425
1425
|
color[2],
|
|
1426
|
-
-1,
|
|
1427
|
-
-1,
|
|
1428
|
-
-1,
|
|
1429
1426
|
false,
|
|
1430
1427
|
true,
|
|
1431
1428
|
false,
|
|
1429
|
+
undefined,
|
|
1430
|
+
undefined,
|
|
1431
|
+
undefined,
|
|
1432
1432
|
false
|
|
1433
1433
|
);
|
|
1434
1434
|
}
|
|
@@ -1443,12 +1443,12 @@ export class Finder<T> {
|
|
|
1443
1443
|
colors.help[0],
|
|
1444
1444
|
colors.help[1],
|
|
1445
1445
|
colors.help[2],
|
|
1446
|
-
-1,
|
|
1447
|
-
-1,
|
|
1448
|
-
-1,
|
|
1449
1446
|
false,
|
|
1450
1447
|
false,
|
|
1451
1448
|
false,
|
|
1449
|
+
undefined,
|
|
1450
|
+
undefined,
|
|
1451
|
+
undefined,
|
|
1452
1452
|
false
|
|
1453
1453
|
);
|
|
1454
1454
|
}
|
package/plugins/lib/fresh.d.ts
CHANGED
|
@@ -37,6 +37,318 @@ type TextPropertyEntry = {
|
|
|
37
37
|
*/
|
|
38
38
|
properties?: Record<string, unknown>;
|
|
39
39
|
};
|
|
40
|
+
type TsCompositeLayoutConfig = {
|
|
41
|
+
/**
|
|
42
|
+
* Layout type: "side-by-side", "stacked", or "unified"
|
|
43
|
+
*/
|
|
44
|
+
type: string;
|
|
45
|
+
/**
|
|
46
|
+
* Width ratios for side-by-side (e.g., [0.5, 0.5])
|
|
47
|
+
*/
|
|
48
|
+
ratios: Array<number> | null;
|
|
49
|
+
/**
|
|
50
|
+
* Show separator between panes
|
|
51
|
+
*/
|
|
52
|
+
showSeparator: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Spacing for stacked layout
|
|
55
|
+
*/
|
|
56
|
+
spacing: number | null;
|
|
57
|
+
};
|
|
58
|
+
type TsCompositeSourceConfig = {
|
|
59
|
+
/**
|
|
60
|
+
* Buffer ID of the source buffer (required)
|
|
61
|
+
*/
|
|
62
|
+
bufferId: number;
|
|
63
|
+
/**
|
|
64
|
+
* Label for this pane (e.g., "OLD", "NEW")
|
|
65
|
+
*/
|
|
66
|
+
label: string;
|
|
67
|
+
/**
|
|
68
|
+
* Whether this pane is editable
|
|
69
|
+
*/
|
|
70
|
+
editable: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Style configuration
|
|
73
|
+
*/
|
|
74
|
+
style: TsCompositePaneStyle | null;
|
|
75
|
+
};
|
|
76
|
+
type TsCompositePaneStyle = {
|
|
77
|
+
/**
|
|
78
|
+
* Background color for added lines (RGB)
|
|
79
|
+
* Using [u8; 3] instead of (u8, u8, u8) for better rquickjs_serde compatibility
|
|
80
|
+
*/
|
|
81
|
+
addBg: [number, number, number] | null;
|
|
82
|
+
/**
|
|
83
|
+
* Background color for removed lines (RGB)
|
|
84
|
+
*/
|
|
85
|
+
removeBg: [number, number, number] | null;
|
|
86
|
+
/**
|
|
87
|
+
* Background color for modified lines (RGB)
|
|
88
|
+
*/
|
|
89
|
+
modifyBg: [number, number, number] | null;
|
|
90
|
+
/**
|
|
91
|
+
* Gutter style: "line-numbers", "diff-markers", "both", or "none"
|
|
92
|
+
*/
|
|
93
|
+
gutterStyle: string | null;
|
|
94
|
+
};
|
|
95
|
+
type TsCompositeHunk = {
|
|
96
|
+
/**
|
|
97
|
+
* Starting line in old buffer (0-indexed)
|
|
98
|
+
*/
|
|
99
|
+
oldStart: number;
|
|
100
|
+
/**
|
|
101
|
+
* Number of lines in old buffer
|
|
102
|
+
*/
|
|
103
|
+
oldCount: number;
|
|
104
|
+
/**
|
|
105
|
+
* Starting line in new buffer (0-indexed)
|
|
106
|
+
*/
|
|
107
|
+
newStart: number;
|
|
108
|
+
/**
|
|
109
|
+
* Number of lines in new buffer
|
|
110
|
+
*/
|
|
111
|
+
newCount: number;
|
|
112
|
+
};
|
|
113
|
+
type TsCreateCompositeBufferOptions = {
|
|
114
|
+
/**
|
|
115
|
+
* Buffer name (displayed in tabs/title)
|
|
116
|
+
*/
|
|
117
|
+
name: string;
|
|
118
|
+
/**
|
|
119
|
+
* Mode for keybindings
|
|
120
|
+
*/
|
|
121
|
+
mode: string;
|
|
122
|
+
/**
|
|
123
|
+
* Layout configuration
|
|
124
|
+
*/
|
|
125
|
+
layout: TsCompositeLayoutConfig;
|
|
126
|
+
/**
|
|
127
|
+
* Source pane configurations
|
|
128
|
+
*/
|
|
129
|
+
sources: Array<TsCompositeSourceConfig>;
|
|
130
|
+
/**
|
|
131
|
+
* Diff hunks for alignment (optional)
|
|
132
|
+
*/
|
|
133
|
+
hunks: Array<TsCompositeHunk> | null;
|
|
134
|
+
};
|
|
135
|
+
type ViewportInfo = {
|
|
136
|
+
/**
|
|
137
|
+
* Byte position of the first visible line
|
|
138
|
+
*/
|
|
139
|
+
topByte: number;
|
|
140
|
+
/**
|
|
141
|
+
* Left column offset (horizontal scroll)
|
|
142
|
+
*/
|
|
143
|
+
leftColumn: number;
|
|
144
|
+
/**
|
|
145
|
+
* Viewport width
|
|
146
|
+
*/
|
|
147
|
+
width: number;
|
|
148
|
+
/**
|
|
149
|
+
* Viewport height
|
|
150
|
+
*/
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
type LayoutHints = {
|
|
154
|
+
/**
|
|
155
|
+
* Optional compose width for centering/wrapping
|
|
156
|
+
*/
|
|
157
|
+
composeWidth: number | null;
|
|
158
|
+
/**
|
|
159
|
+
* Optional column guides for aligned tables
|
|
160
|
+
*/
|
|
161
|
+
columnGuides: Array<number> | null;
|
|
162
|
+
};
|
|
163
|
+
type ViewTokenWire = {
|
|
164
|
+
/**
|
|
165
|
+
* Source byte offset in the buffer. None for injected content (annotations).
|
|
166
|
+
*/
|
|
167
|
+
source_offset: number | null;
|
|
168
|
+
/**
|
|
169
|
+
* The token content
|
|
170
|
+
*/
|
|
171
|
+
kind: ViewTokenWireKind;
|
|
172
|
+
/**
|
|
173
|
+
* Optional styling for injected content (only used when source_offset is None)
|
|
174
|
+
*/
|
|
175
|
+
style?: ViewTokenStyle;
|
|
176
|
+
};
|
|
177
|
+
type ViewTokenWireKind = {
|
|
178
|
+
"Text": string;
|
|
179
|
+
} | "Newline" | "Space" | "Break" | {
|
|
180
|
+
"BinaryByte": number;
|
|
181
|
+
};
|
|
182
|
+
type ViewTokenStyle = {
|
|
183
|
+
/**
|
|
184
|
+
* Foreground color as RGB tuple
|
|
185
|
+
*/
|
|
186
|
+
fg: [number, number, number] | null;
|
|
187
|
+
/**
|
|
188
|
+
* Background color as RGB tuple
|
|
189
|
+
*/
|
|
190
|
+
bg: [number, number, number] | null;
|
|
191
|
+
/**
|
|
192
|
+
* Whether to render in bold
|
|
193
|
+
*/
|
|
194
|
+
bold: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Whether to render in italic
|
|
197
|
+
*/
|
|
198
|
+
italic: boolean;
|
|
199
|
+
};
|
|
200
|
+
type PromptSuggestion = {
|
|
201
|
+
/**
|
|
202
|
+
* The text to display
|
|
203
|
+
*/
|
|
204
|
+
text: string;
|
|
205
|
+
/**
|
|
206
|
+
* Optional description
|
|
207
|
+
*/
|
|
208
|
+
description?: string;
|
|
209
|
+
/**
|
|
210
|
+
* The value to use when selected (defaults to text if None)
|
|
211
|
+
*/
|
|
212
|
+
value?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Whether this suggestion is disabled (greyed out, defaults to false)
|
|
215
|
+
*/
|
|
216
|
+
disabled?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Optional keyboard shortcut
|
|
219
|
+
*/
|
|
220
|
+
keybinding?: string;
|
|
221
|
+
};
|
|
222
|
+
type DirEntry = {
|
|
223
|
+
/**
|
|
224
|
+
* File/directory name
|
|
225
|
+
*/
|
|
226
|
+
name: string;
|
|
227
|
+
/**
|
|
228
|
+
* True if this is a file
|
|
229
|
+
*/
|
|
230
|
+
is_file: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* True if this is a directory
|
|
233
|
+
*/
|
|
234
|
+
is_dir: boolean;
|
|
235
|
+
};
|
|
236
|
+
type BufferInfo = {
|
|
237
|
+
/**
|
|
238
|
+
* Buffer ID
|
|
239
|
+
*/
|
|
240
|
+
id: number;
|
|
241
|
+
/**
|
|
242
|
+
* File path (if any)
|
|
243
|
+
*/
|
|
244
|
+
path: string;
|
|
245
|
+
/**
|
|
246
|
+
* Whether the buffer has been modified
|
|
247
|
+
*/
|
|
248
|
+
modified: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Length of buffer in bytes
|
|
251
|
+
*/
|
|
252
|
+
length: number;
|
|
253
|
+
};
|
|
254
|
+
type JsDiagnostic = {
|
|
255
|
+
/**
|
|
256
|
+
* Document URI
|
|
257
|
+
*/
|
|
258
|
+
uri: string;
|
|
259
|
+
/**
|
|
260
|
+
* Diagnostic message
|
|
261
|
+
*/
|
|
262
|
+
message: string;
|
|
263
|
+
/**
|
|
264
|
+
* Severity: 1=Error, 2=Warning, 3=Info, 4=Hint, null=unknown
|
|
265
|
+
*/
|
|
266
|
+
severity: number | null;
|
|
267
|
+
/**
|
|
268
|
+
* Range in the document
|
|
269
|
+
*/
|
|
270
|
+
range: JsRange;
|
|
271
|
+
/**
|
|
272
|
+
* Source of the diagnostic (e.g., "typescript", "eslint")
|
|
273
|
+
*/
|
|
274
|
+
source?: string;
|
|
275
|
+
};
|
|
276
|
+
type JsRange = {
|
|
277
|
+
/**
|
|
278
|
+
* Start position
|
|
279
|
+
*/
|
|
280
|
+
start: JsPosition;
|
|
281
|
+
/**
|
|
282
|
+
* End position
|
|
283
|
+
*/
|
|
284
|
+
end: JsPosition;
|
|
285
|
+
};
|
|
286
|
+
type JsPosition = {
|
|
287
|
+
/**
|
|
288
|
+
* Zero-indexed line number
|
|
289
|
+
*/
|
|
290
|
+
line: number;
|
|
291
|
+
/**
|
|
292
|
+
* Zero-indexed character offset
|
|
293
|
+
*/
|
|
294
|
+
character: number;
|
|
295
|
+
};
|
|
296
|
+
type ActionSpec = {
|
|
297
|
+
/**
|
|
298
|
+
* Action name (e.g., "move_word_right", "delete_line")
|
|
299
|
+
*/
|
|
300
|
+
action: string;
|
|
301
|
+
/**
|
|
302
|
+
* Number of times to repeat the action (default 1)
|
|
303
|
+
*/
|
|
304
|
+
count: number;
|
|
305
|
+
};
|
|
306
|
+
type TsActionPopupAction = {
|
|
307
|
+
/**
|
|
308
|
+
* Unique action identifier (returned in ActionPopupResult)
|
|
309
|
+
*/
|
|
310
|
+
id: string;
|
|
311
|
+
/**
|
|
312
|
+
* Display text for the button (can include command hints)
|
|
313
|
+
*/
|
|
314
|
+
label: string;
|
|
315
|
+
};
|
|
316
|
+
type ActionPopupOptions = {
|
|
317
|
+
/**
|
|
318
|
+
* Unique identifier for the popup (used in ActionPopupResult)
|
|
319
|
+
*/
|
|
320
|
+
id: string;
|
|
321
|
+
/**
|
|
322
|
+
* Title text for the popup
|
|
323
|
+
*/
|
|
324
|
+
title: string;
|
|
325
|
+
/**
|
|
326
|
+
* Body message (supports basic formatting)
|
|
327
|
+
*/
|
|
328
|
+
message: string;
|
|
329
|
+
/**
|
|
330
|
+
* Action buttons to display
|
|
331
|
+
*/
|
|
332
|
+
actions: Array<TsActionPopupAction>;
|
|
333
|
+
};
|
|
334
|
+
type FileExplorerDecoration = {
|
|
335
|
+
/**
|
|
336
|
+
* File path to decorate
|
|
337
|
+
*/
|
|
338
|
+
path: string;
|
|
339
|
+
/**
|
|
340
|
+
* Symbol to display (e.g., "●", "M", "A")
|
|
341
|
+
*/
|
|
342
|
+
symbol: string;
|
|
343
|
+
/**
|
|
344
|
+
* Color as RGB array (rquickjs_serde requires array, not tuple)
|
|
345
|
+
*/
|
|
346
|
+
color: [number, number, number];
|
|
347
|
+
/**
|
|
348
|
+
* Priority for display when multiple decorations exist (higher wins)
|
|
349
|
+
*/
|
|
350
|
+
priority: number;
|
|
351
|
+
};
|
|
40
352
|
type BackgroundProcessResult = {
|
|
41
353
|
/**
|
|
42
354
|
* Unique process ID for later reference
|
|
@@ -53,6 +365,46 @@ type BufferSavedDiff = {
|
|
|
53
365
|
byte_ranges: Array<[number, number]>;
|
|
54
366
|
line_ranges: Array<[number, number]> | null;
|
|
55
367
|
};
|
|
368
|
+
type TsCompositeHunk = {
|
|
369
|
+
/**
|
|
370
|
+
* Starting line in old buffer (0-indexed)
|
|
371
|
+
*/
|
|
372
|
+
oldStart: number;
|
|
373
|
+
/**
|
|
374
|
+
* Number of lines in old buffer
|
|
375
|
+
*/
|
|
376
|
+
oldCount: number;
|
|
377
|
+
/**
|
|
378
|
+
* Starting line in new buffer (0-indexed)
|
|
379
|
+
*/
|
|
380
|
+
newStart: number;
|
|
381
|
+
/**
|
|
382
|
+
* Number of lines in new buffer
|
|
383
|
+
*/
|
|
384
|
+
newCount: number;
|
|
385
|
+
};
|
|
386
|
+
type TsCreateCompositeBufferOptions = {
|
|
387
|
+
/**
|
|
388
|
+
* Buffer name (displayed in tabs/title)
|
|
389
|
+
*/
|
|
390
|
+
name: string;
|
|
391
|
+
/**
|
|
392
|
+
* Mode for keybindings
|
|
393
|
+
*/
|
|
394
|
+
mode: string;
|
|
395
|
+
/**
|
|
396
|
+
* Layout configuration
|
|
397
|
+
*/
|
|
398
|
+
layout: TsCompositeLayoutConfig;
|
|
399
|
+
/**
|
|
400
|
+
* Source pane configurations
|
|
401
|
+
*/
|
|
402
|
+
sources: Array<TsCompositeSourceConfig>;
|
|
403
|
+
/**
|
|
404
|
+
* Diff hunks for alignment (optional)
|
|
405
|
+
*/
|
|
406
|
+
hunks: Array<TsCompositeHunk> | null;
|
|
407
|
+
};
|
|
56
408
|
type CreateVirtualBufferInExistingSplitOptions = {
|
|
57
409
|
/**
|
|
58
410
|
* Buffer name (displayed in tabs/title)
|
|
@@ -185,6 +537,28 @@ type SpawnResult = {
|
|
|
185
537
|
*/
|
|
186
538
|
exit_code: number;
|
|
187
539
|
};
|
|
540
|
+
type PromptSuggestion = {
|
|
541
|
+
/**
|
|
542
|
+
* The text to display
|
|
543
|
+
*/
|
|
544
|
+
text: string;
|
|
545
|
+
/**
|
|
546
|
+
* Optional description
|
|
547
|
+
*/
|
|
548
|
+
description?: string;
|
|
549
|
+
/**
|
|
550
|
+
* The value to use when selected (defaults to text if None)
|
|
551
|
+
*/
|
|
552
|
+
value?: string;
|
|
553
|
+
/**
|
|
554
|
+
* Whether this suggestion is disabled (greyed out, defaults to false)
|
|
555
|
+
*/
|
|
556
|
+
disabled?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Optional keyboard shortcut
|
|
559
|
+
*/
|
|
560
|
+
keybinding?: string;
|
|
561
|
+
};
|
|
188
562
|
type TextPropertiesAtCursor = Array<Record<string, unknown>>;
|
|
189
563
|
type TsHighlightSpan = {
|
|
190
564
|
start: number;
|
|
@@ -193,6 +567,16 @@ type TsHighlightSpan = {
|
|
|
193
567
|
bold: boolean;
|
|
194
568
|
italic: boolean;
|
|
195
569
|
};
|
|
570
|
+
type VirtualBufferResult = {
|
|
571
|
+
/**
|
|
572
|
+
* The created buffer ID
|
|
573
|
+
*/
|
|
574
|
+
bufferId: number;
|
|
575
|
+
/**
|
|
576
|
+
* The split ID (if created in a new split)
|
|
577
|
+
*/
|
|
578
|
+
splitId: number | null;
|
|
579
|
+
};
|
|
196
580
|
/**
|
|
197
581
|
* Main editor API interface
|
|
198
582
|
*/
|
|
@@ -208,7 +592,7 @@ interface EditorAPI {
|
|
|
208
592
|
/**
|
|
209
593
|
* List all open buffers - returns array of BufferInfo objects
|
|
210
594
|
*/
|
|
211
|
-
listBuffers():
|
|
595
|
+
listBuffers(): BufferInfo[];
|
|
212
596
|
debug(msg: string): void;
|
|
213
597
|
info(msg: string): void;
|
|
214
598
|
warn(msg: string): void;
|
|
@@ -262,7 +646,7 @@ interface EditorAPI {
|
|
|
262
646
|
/**
|
|
263
647
|
* Get buffer info by ID
|
|
264
648
|
*/
|
|
265
|
-
getBufferInfo(bufferId: number):
|
|
649
|
+
getBufferInfo(bufferId: number): BufferInfo | null;
|
|
266
650
|
/**
|
|
267
651
|
* Get primary cursor info for active buffer
|
|
268
652
|
*/
|
|
@@ -278,12 +662,17 @@ interface EditorAPI {
|
|
|
278
662
|
/**
|
|
279
663
|
* Get viewport info for active buffer
|
|
280
664
|
*/
|
|
281
|
-
getViewport():
|
|
665
|
+
getViewport(): ViewportInfo | null;
|
|
282
666
|
/**
|
|
283
667
|
* Get the line number (0-indexed) of the primary cursor
|
|
284
668
|
*/
|
|
285
669
|
getCursorLine(): number;
|
|
286
670
|
/**
|
|
671
|
+
* Get the byte offset of the start of a line (0-indexed line number)
|
|
672
|
+
* Returns null if the line number is out of range
|
|
673
|
+
*/
|
|
674
|
+
getLineStartPosition(line: number): Promise<number | null>;
|
|
675
|
+
/**
|
|
287
676
|
* Find buffer by file path, returns buffer ID or 0 if not found
|
|
288
677
|
*/
|
|
289
678
|
findBufferByPath(path: string): number;
|
|
@@ -371,7 +760,7 @@ interface EditorAPI {
|
|
|
371
760
|
/**
|
|
372
761
|
* Read directory contents (returns array of {name, is_file, is_dir})
|
|
373
762
|
*/
|
|
374
|
-
readDir(path: string):
|
|
763
|
+
readDir(path: string): DirEntry[];
|
|
375
764
|
/**
|
|
376
765
|
* Get current config as JS object
|
|
377
766
|
*/
|
|
@@ -426,12 +815,17 @@ interface EditorAPI {
|
|
|
426
815
|
pluginTranslate(pluginName: string, key: string, args?: Record<string, unknown>): string;
|
|
427
816
|
/**
|
|
428
817
|
* Create a composite buffer (async)
|
|
818
|
+
*
|
|
819
|
+
* Uses typed CreateCompositeBufferOptions - serde validates field names at runtime
|
|
820
|
+
* via `deny_unknown_fields` attribute
|
|
429
821
|
*/
|
|
430
|
-
createCompositeBuffer(opts:
|
|
822
|
+
createCompositeBuffer(opts: CreateCompositeBufferOptions): Promise<number>;
|
|
431
823
|
/**
|
|
432
824
|
* Update alignment hunks for a composite buffer
|
|
825
|
+
*
|
|
826
|
+
* Uses typed Vec<CompositeHunk> - serde validates field names at runtime
|
|
433
827
|
*/
|
|
434
|
-
updateCompositeAlignment(bufferId: number, hunks:
|
|
828
|
+
updateCompositeAlignment(bufferId: number, hunks: CompositeHunk[]): boolean;
|
|
435
829
|
/**
|
|
436
830
|
* Close a composite buffer
|
|
437
831
|
*/
|
|
@@ -462,6 +856,9 @@ interface EditorAPI {
|
|
|
462
856
|
removeOverlay(bufferId: number, handle: string): boolean;
|
|
463
857
|
/**
|
|
464
858
|
* Submit a view transform for a buffer/split
|
|
859
|
+
*
|
|
860
|
+
* Note: tokens should be ViewTokenWire[], layoutHints should be LayoutHints
|
|
861
|
+
* These use manual parsing due to complex enum handling
|
|
465
862
|
*/
|
|
466
863
|
submitViewTransform(bufferId: number, splitId: number | null, start: number, end: number, tokens: Record<string, unknown>[], LayoutHints?: Record<string, unknown>): boolean;
|
|
467
864
|
/**
|
|
@@ -470,8 +867,10 @@ interface EditorAPI {
|
|
|
470
867
|
clearViewTransform(bufferId: number, splitId: number | null): boolean;
|
|
471
868
|
/**
|
|
472
869
|
* Set file explorer decorations for a namespace
|
|
870
|
+
*
|
|
871
|
+
* Uses typed Vec<FileExplorerDecoration> - serde validates field names at runtime
|
|
473
872
|
*/
|
|
474
|
-
setFileExplorerDecorations(namespace: string, decorations:
|
|
873
|
+
setFileExplorerDecorations(namespace: string, decorations: FileExplorerDecoration[]): boolean;
|
|
475
874
|
/**
|
|
476
875
|
* Clear file explorer decorations for a namespace
|
|
477
876
|
*/
|
|
@@ -501,6 +900,11 @@ interface EditorAPI {
|
|
|
501
900
|
*/
|
|
502
901
|
addVirtualLine(bufferId: number, position: number, text: string, fgR: number, fgG: number, fgB: number, bgR: number, bgG: number, bgB: number, above: boolean, namespace: string, priority: number): boolean;
|
|
503
902
|
/**
|
|
903
|
+
* Show a prompt and wait for user input (async)
|
|
904
|
+
* Returns the user input or null if cancelled
|
|
905
|
+
*/
|
|
906
|
+
prompt(label: string, initialValue: string): Promise<string | null>;
|
|
907
|
+
/**
|
|
504
908
|
* Start an interactive prompt
|
|
505
909
|
*/
|
|
506
910
|
startPrompt(label: string, promptType: string): boolean;
|
|
@@ -509,9 +913,11 @@ interface EditorAPI {
|
|
|
509
913
|
*/
|
|
510
914
|
startPromptWithInitial(label: string, promptType: string, initialValue: string): boolean;
|
|
511
915
|
/**
|
|
512
|
-
* Set suggestions for the current prompt
|
|
916
|
+
* Set suggestions for the current prompt
|
|
917
|
+
*
|
|
918
|
+
* Uses typed Vec<Suggestion> - serde validates field names at runtime
|
|
513
919
|
*/
|
|
514
|
-
setPromptSuggestions(
|
|
920
|
+
setPromptSuggestions(suggestions: Suggestion[]): boolean;
|
|
515
921
|
/**
|
|
516
922
|
* Define a buffer mode (takes bindings as array of [key, command] pairs)
|
|
517
923
|
*/
|
|
@@ -578,12 +984,16 @@ interface EditorAPI {
|
|
|
578
984
|
removeScrollSyncGroup(groupId: number): boolean;
|
|
579
985
|
/**
|
|
580
986
|
* Execute multiple actions in sequence
|
|
987
|
+
*
|
|
988
|
+
* Takes typed ActionSpec array - serde validates field names at runtime
|
|
581
989
|
*/
|
|
582
|
-
executeActions(actions:
|
|
990
|
+
executeActions(actions: ActionSpec[]): boolean;
|
|
583
991
|
/**
|
|
584
992
|
* Show an action popup
|
|
993
|
+
*
|
|
994
|
+
* Takes a typed ActionPopupOptions struct - serde validates field names at runtime
|
|
585
995
|
*/
|
|
586
|
-
showActionPopup(opts:
|
|
996
|
+
showActionPopup(opts: ActionPopupOptions): boolean;
|
|
587
997
|
/**
|
|
588
998
|
* Disable LSP for a specific language
|
|
589
999
|
*/
|
|
@@ -591,25 +1001,27 @@ interface EditorAPI {
|
|
|
591
1001
|
/**
|
|
592
1002
|
* Get all diagnostics from LSP
|
|
593
1003
|
*/
|
|
594
|
-
getAllDiagnostics():
|
|
1004
|
+
getAllDiagnostics(): JsDiagnostic[];
|
|
595
1005
|
/**
|
|
596
1006
|
* Get registered event handlers for an event
|
|
597
1007
|
*/
|
|
598
1008
|
getHandlers(eventName: string): string[];
|
|
599
1009
|
/**
|
|
600
|
-
* Create a virtual buffer in current split (async, returns buffer
|
|
1010
|
+
* Create a virtual buffer in current split (async, returns buffer and split IDs)
|
|
601
1011
|
*/
|
|
602
|
-
createVirtualBuffer(opts: CreateVirtualBufferOptions): Promise<
|
|
1012
|
+
createVirtualBuffer(opts: CreateVirtualBufferOptions): Promise<VirtualBufferResult>;
|
|
603
1013
|
/**
|
|
604
|
-
* Create a virtual buffer in a new split (async, returns
|
|
1014
|
+
* Create a virtual buffer in a new split (async, returns buffer and split IDs)
|
|
605
1015
|
*/
|
|
606
|
-
createVirtualBufferInSplit(opts: CreateVirtualBufferInSplitOptions): Promise<
|
|
1016
|
+
createVirtualBufferInSplit(opts: CreateVirtualBufferInSplitOptions): Promise<VirtualBufferResult>;
|
|
607
1017
|
/**
|
|
608
|
-
* Create a virtual buffer in an existing split (async, returns
|
|
1018
|
+
* Create a virtual buffer in an existing split (async, returns buffer and split IDs)
|
|
609
1019
|
*/
|
|
610
|
-
createVirtualBufferInExistingSplit(opts: CreateVirtualBufferInExistingSplitOptions): Promise<
|
|
1020
|
+
createVirtualBufferInExistingSplit(opts: CreateVirtualBufferInExistingSplitOptions): Promise<VirtualBufferResult>;
|
|
611
1021
|
/**
|
|
612
1022
|
* Set virtual buffer content (takes array of entry objects)
|
|
1023
|
+
*
|
|
1024
|
+
* Note: entries should be TextPropertyEntry[] - uses manual parsing for HashMap support
|
|
613
1025
|
*/
|
|
614
1026
|
setVirtualBufferContent(bufferId: number, entriesArr: Record<string, unknown>[]): boolean;
|
|
615
1027
|
/**
|