@fresh-editor/fresh-editor 0.1.75 → 0.1.77
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 +55 -0
- package/README.md +8 -0
- package/package.json +1 -1
- package/plugins/audit_mode.ts +9 -4
- package/plugins/buffer_modified.ts +1 -1
- package/plugins/calculator.ts +1 -1
- package/plugins/check-types.sh +41 -0
- package/plugins/clangd_support.ts +1 -1
- package/plugins/color_highlighter.ts +4 -1
- package/plugins/config-schema.json +75 -3
- package/plugins/diagnostics_panel.i18n.json +52 -52
- package/plugins/diagnostics_panel.ts +168 -540
- package/plugins/find_references.ts +82 -324
- package/plugins/git_blame.i18n.json +260 -247
- package/plugins/git_blame.ts +4 -9
- package/plugins/git_explorer.ts +159 -0
- package/plugins/git_find_file.ts +42 -270
- package/plugins/git_grep.ts +50 -167
- package/plugins/git_gutter.ts +1 -1
- package/plugins/git_log.ts +4 -11
- package/plugins/lib/finder.ts +1499 -0
- package/plugins/lib/fresh.d.ts +118 -17
- package/plugins/lib/index.ts +23 -1
- package/plugins/lib/navigation-controller.ts +1 -1
- package/plugins/lib/panel-manager.ts +7 -13
- package/plugins/lib/results-panel.ts +914 -0
- package/plugins/lib/search-utils.ts +343 -0
- package/plugins/lib/types.ts +14 -0
- package/plugins/lib/virtual-buffer-factory.ts +3 -2
- package/plugins/live_grep.ts +56 -379
- package/plugins/markdown_compose.ts +1 -17
- package/plugins/merge_conflict.ts +16 -14
- package/plugins/odin-lsp.ts +135 -0
- package/plugins/path_complete.ts +1 -1
- package/plugins/search_replace.i18n.json +13 -13
- package/plugins/search_replace.ts +11 -9
- package/plugins/theme_editor.ts +15 -9
- package/plugins/todo_highlighter.ts +1 -0
- package/plugins/vi_mode.ts +9 -5
- package/plugins/welcome.ts +1 -1
package/plugins/lib/fresh.d.ts
CHANGED
|
@@ -46,11 +46,90 @@
|
|
|
46
46
|
* and define buffer-local keybindings. Virtual buffers typically use custom modes.
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Get the editor API instance.
|
|
51
|
+
* Plugins must call this at the top of their file to get a scoped editor object.
|
|
52
|
+
* @returns The editor API object for this plugin
|
|
53
|
+
* @example
|
|
54
|
+
* const editor = getEditor();
|
|
55
|
+
*/
|
|
56
|
+
declare function getEditor(): EditorAPI;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Plugin-specific methods added by the JavaScript runtime wrapper.
|
|
60
|
+
* These extend the base EditorAPI with i18n and command registration helpers.
|
|
61
|
+
*/
|
|
62
|
+
interface EditorAPI {
|
|
63
|
+
/**
|
|
64
|
+
* Translate a string using the plugin's i18n file
|
|
65
|
+
* @param key - Translation key (e.g., "status.ready")
|
|
66
|
+
* @param args - Optional interpolation arguments
|
|
67
|
+
* @returns Translated string
|
|
68
|
+
*/
|
|
69
|
+
t(key: string, args?: Record<string, string>): string;
|
|
70
|
+
|
|
50
71
|
/**
|
|
51
|
-
*
|
|
72
|
+
* Get the i18n helper object (for compatibility)
|
|
73
|
+
* @returns Object with t() method bound to this plugin
|
|
52
74
|
*/
|
|
53
|
-
|
|
75
|
+
getL10n(): { t: (key: string, args?: Record<string, string>) => string };
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Register a custom command (plugin wrapper - source is added automatically)
|
|
79
|
+
* @param name - Command name (use %key for i18n)
|
|
80
|
+
* @param description - Command description (use %key for i18n)
|
|
81
|
+
* @param action - Global function name to call
|
|
82
|
+
* @param contexts - Comma-separated contexts (default: "")
|
|
83
|
+
* @returns true if command was registered
|
|
84
|
+
*/
|
|
85
|
+
registerCommand(name: string, description: string, action: string, contexts?: string): boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Copy text to system clipboard (alias for setClipboard)
|
|
89
|
+
* @param text - Text to copy
|
|
90
|
+
*/
|
|
91
|
+
copyToClipboard(text: string): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Join path segments into a single path (variadic version)
|
|
95
|
+
* @param parts - Path segments to join
|
|
96
|
+
* @returns Joined path string
|
|
97
|
+
*/
|
|
98
|
+
pathJoin(...parts: string[]): string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Add a visual overlay to buffer text (with optional parameters)
|
|
102
|
+
* Most parameters have defaults: bold=false, italic=false, bg=-1 (transparent), extend=false
|
|
103
|
+
*/
|
|
104
|
+
addOverlay(
|
|
105
|
+
buffer_id: number,
|
|
106
|
+
namespace: string,
|
|
107
|
+
start: number,
|
|
108
|
+
end: number,
|
|
109
|
+
r: number,
|
|
110
|
+
g: number,
|
|
111
|
+
b: number,
|
|
112
|
+
underline: boolean,
|
|
113
|
+
bold?: boolean,
|
|
114
|
+
italic?: boolean,
|
|
115
|
+
bg_r?: number,
|
|
116
|
+
bg_g?: number,
|
|
117
|
+
bg_b?: number,
|
|
118
|
+
extend_to_line_end?: boolean
|
|
119
|
+
): boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get the theme JSON Schema (with proper typing)
|
|
123
|
+
*/
|
|
124
|
+
getThemeSchema(): {
|
|
125
|
+
$defs?: Record<string, Record<string, unknown>>;
|
|
126
|
+
properties?: Record<string, unknown>;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get built-in themes as a map of name to JSON string
|
|
131
|
+
*/
|
|
132
|
+
getBuiltinThemes(): Record<string, string>;
|
|
54
133
|
}
|
|
55
134
|
|
|
56
135
|
/**
|
|
@@ -91,6 +170,18 @@ interface ProcessHandle extends PromiseLike<SpawnResult> {
|
|
|
91
170
|
kill(): Promise<boolean>;
|
|
92
171
|
}
|
|
93
172
|
|
|
173
|
+
/** File explorer decoration entry provided by plugins */
|
|
174
|
+
interface FileExplorerDecoration {
|
|
175
|
+
/** Absolute or workspace-relative path to decorate */
|
|
176
|
+
path: string;
|
|
177
|
+
/** Symbol to display (single character recommended) */
|
|
178
|
+
symbol?: string | null;
|
|
179
|
+
/** RGB color for the symbol */
|
|
180
|
+
color?: [u8; 3] | null;
|
|
181
|
+
/** Priority for resolving conflicts (higher wins) */
|
|
182
|
+
priority?: number | null;
|
|
183
|
+
}
|
|
184
|
+
|
|
94
185
|
/** Result from spawnProcess */
|
|
95
186
|
interface SpawnResult {
|
|
96
187
|
/** Complete stdout as string. Newlines preserved; trailing newline included. */
|
|
@@ -309,7 +400,7 @@ interface TsCompositeLayoutConfig {
|
|
|
309
400
|
/** Show separator between panes */
|
|
310
401
|
show_separator?: boolean | null;
|
|
311
402
|
/** Spacing between stacked panes */
|
|
312
|
-
spacing?:
|
|
403
|
+
spacing?: number | null;
|
|
313
404
|
}
|
|
314
405
|
|
|
315
406
|
/** Pane style configuration */
|
|
@@ -515,7 +606,7 @@ interface EditorAPI {
|
|
|
515
606
|
* @param process_id - ID returned from spawnBackgroundProcess
|
|
516
607
|
* @returns true if process is running, false if not found or exited
|
|
517
608
|
*/
|
|
518
|
-
isProcessRunning(
|
|
609
|
+
isProcessRunning(process_id: number): boolean;
|
|
519
610
|
/** Compute syntax highlighting for a buffer range */
|
|
520
611
|
getHighlights(buffer_id: number, start: number, end: number): Promise<TsHighlightSpan[]>;
|
|
521
612
|
/** Get diff vs last saved snapshot for a buffer */
|
|
@@ -686,7 +777,7 @@ interface EditorAPI {
|
|
|
686
777
|
* @param priority - Priority for ordering multiple lines at same position
|
|
687
778
|
* @returns true if virtual line was added
|
|
688
779
|
*/
|
|
689
|
-
addVirtualLine(buffer_id: number, position: number, text: string, fg_r: number, fg_g: number, fg_b: number, bg_r:
|
|
780
|
+
addVirtualLine(buffer_id: number, position: number, text: string, fg_r: number, fg_g: number, fg_b: number, bg_r: number, bg_g: number, bg_b: number, above: boolean, namespace: string, priority: number): boolean;
|
|
690
781
|
/**
|
|
691
782
|
* Set a line indicator in the gutter's indicator column
|
|
692
783
|
* @param buffer_id - The buffer ID
|
|
@@ -707,6 +798,19 @@ interface EditorAPI {
|
|
|
707
798
|
* @returns true if indicators were cleared
|
|
708
799
|
*/
|
|
709
800
|
clearLineIndicators(buffer_id: number, namespace: string): boolean;
|
|
801
|
+
/**
|
|
802
|
+
* Set file explorer decorations for a namespace
|
|
803
|
+
* @param namespace - Namespace for grouping (e.g., "git-status")
|
|
804
|
+
* @param decorations - Decoration entries
|
|
805
|
+
* @returns true if decorations were accepted
|
|
806
|
+
*/
|
|
807
|
+
setFileExplorerDecorations(namespace: string, decorations: FileExplorerDecoration[]): boolean;
|
|
808
|
+
/**
|
|
809
|
+
* Clear file explorer decorations for a namespace
|
|
810
|
+
* @param namespace - Namespace to clear (e.g., "git-status")
|
|
811
|
+
* @returns true if decorations were cleared
|
|
812
|
+
*/
|
|
813
|
+
clearFileExplorerDecorations(namespace: string): boolean;
|
|
710
814
|
/**
|
|
711
815
|
* Submit a transformed view stream for a viewport
|
|
712
816
|
* @param buffer_id - Buffer to apply the transform to
|
|
@@ -793,14 +897,14 @@ interface EditorAPI {
|
|
|
793
897
|
* @param process_id - ID returned from spawnBackgroundProcess or spawnProcessStart
|
|
794
898
|
* @returns true if process was killed, false if not found
|
|
795
899
|
*/
|
|
796
|
-
killProcess(
|
|
900
|
+
killProcess(process_id: number): Promise<boolean>;
|
|
797
901
|
/**
|
|
798
902
|
* Wait for a cancellable process to complete and get its result
|
|
799
903
|
*
|
|
800
904
|
* @param process_id - ID returned from spawnProcessStart
|
|
801
905
|
* @returns SpawnResult with stdout, stderr, and exit_code
|
|
802
906
|
*/
|
|
803
|
-
spawnProcessWait(
|
|
907
|
+
spawnProcessWait(process_id: number): Promise<SpawnResult>;
|
|
804
908
|
/**
|
|
805
909
|
* Delay execution for a specified number of milliseconds
|
|
806
910
|
*
|
|
@@ -809,7 +913,7 @@ interface EditorAPI {
|
|
|
809
913
|
* @example
|
|
810
914
|
* await editor.delay(100); // Wait 100ms
|
|
811
915
|
*/
|
|
812
|
-
delay(
|
|
916
|
+
delay(ms: number): Promise<void>;
|
|
813
917
|
/** Find a buffer ID by its file path */
|
|
814
918
|
findBufferByPath(path: string): number;
|
|
815
919
|
/**
|
|
@@ -827,7 +931,7 @@ interface EditorAPI {
|
|
|
827
931
|
* This is a safe operation that prevents plugins from deleting arbitrary files.
|
|
828
932
|
* @param name - Theme name (without .json extension)
|
|
829
933
|
*/
|
|
830
|
-
deleteTheme(name: string): Promise<
|
|
934
|
+
deleteTheme(name: string): Promise<void>;
|
|
831
935
|
/**
|
|
832
936
|
* Create a composite buffer that displays multiple source buffers
|
|
833
937
|
*
|
|
@@ -946,7 +1050,7 @@ interface EditorAPI {
|
|
|
946
1050
|
* Anchors map corresponding line numbers between left and right buffers.
|
|
947
1051
|
* Each anchor is a tuple of (left_line, right_line).
|
|
948
1052
|
*/
|
|
949
|
-
setScrollSyncAnchors(group_id: number, anchors:
|
|
1053
|
+
setScrollSyncAnchors(group_id: number, anchors: [number, number][]): boolean;
|
|
950
1054
|
/** Remove a scroll sync group */
|
|
951
1055
|
removeScrollSyncGroup(group_id: number): boolean;
|
|
952
1056
|
|
|
@@ -989,7 +1093,7 @@ interface EditorAPI {
|
|
|
989
1093
|
* @param extend_to_line_end - Extend background to end of visual line
|
|
990
1094
|
* @returns true if overlay was added
|
|
991
1095
|
*/
|
|
992
|
-
addOverlay(buffer_id: number, namespace: string, start: number, end: number, r: number, g: number, b: number, bg_r:
|
|
1096
|
+
addOverlay(buffer_id: number, namespace: string, start: number, end: number, r: number, g: number, b: number, bg_r: number, bg_g: number, bg_b: number, underline: boolean, bold: boolean, italic: boolean, extend_to_line_end: boolean): boolean;
|
|
993
1097
|
/**
|
|
994
1098
|
* Remove a specific overlay by its handle
|
|
995
1099
|
* @param buffer_id - The buffer ID
|
|
@@ -1076,7 +1180,7 @@ interface EditorAPI {
|
|
|
1076
1180
|
* @param path - Destination path (absolute or relative to cwd)
|
|
1077
1181
|
* @param content - UTF-8 string to write
|
|
1078
1182
|
*/
|
|
1079
|
-
writeFile(path: string, content: string): Promise<
|
|
1183
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
1080
1184
|
/**
|
|
1081
1185
|
* Check if a path exists (file, directory, or symlink)
|
|
1082
1186
|
*
|
|
@@ -1264,7 +1368,7 @@ interface EditorAPI {
|
|
|
1264
1368
|
* ["q", "close_buffer"]
|
|
1265
1369
|
* ], true);
|
|
1266
1370
|
*/
|
|
1267
|
-
defineMode(name: string, parent: string, bindings:
|
|
1371
|
+
defineMode(name: string, parent: string, bindings: [string, string][], read_only: boolean): boolean;
|
|
1268
1372
|
/**
|
|
1269
1373
|
* Switch the current split to display a buffer
|
|
1270
1374
|
* @param buffer_id - ID of the buffer to show
|
|
@@ -1316,6 +1420,3 @@ interface EditorAPI {
|
|
|
1316
1420
|
setVirtualBufferContent(buffer_id: number, entries: TextPropertyEntry[]): boolean;
|
|
1317
1421
|
|
|
1318
1422
|
}
|
|
1319
|
-
|
|
1320
|
-
// Export for module compatibility
|
|
1321
|
-
export {};
|
package/plugins/lib/index.ts
CHANGED
|
@@ -11,7 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
// Types
|
|
14
|
-
export type {
|
|
14
|
+
export type {
|
|
15
|
+
RGB,
|
|
16
|
+
Location,
|
|
17
|
+
PanelOptions,
|
|
18
|
+
PanelState,
|
|
19
|
+
NavigationOptions,
|
|
20
|
+
HighlightPattern,
|
|
21
|
+
FileExplorerDecoration,
|
|
22
|
+
} from "./types.ts";
|
|
15
23
|
|
|
16
24
|
// Panel Management
|
|
17
25
|
export { PanelManager } from "./panel-manager.ts";
|
|
@@ -22,3 +30,17 @@ export { NavigationController } from "./navigation-controller.ts";
|
|
|
22
30
|
// Buffer Creation
|
|
23
31
|
export { createVirtualBufferFactory } from "./virtual-buffer-factory.ts";
|
|
24
32
|
export type { VirtualBufferOptions, SplitBufferOptions } from "./virtual-buffer-factory.ts";
|
|
33
|
+
|
|
34
|
+
// Finder Abstraction
|
|
35
|
+
export { Finder, defaultFuzzyFilter, parseGrepLine, parseGrepOutput, getRelativePath, createLiveProvider } from "./finder.ts";
|
|
36
|
+
export type {
|
|
37
|
+
DisplayEntry,
|
|
38
|
+
SearchSource,
|
|
39
|
+
FilterSource,
|
|
40
|
+
PreviewConfig,
|
|
41
|
+
FinderConfig,
|
|
42
|
+
PromptOptions,
|
|
43
|
+
PanelOptions as FinderPanelOptions,
|
|
44
|
+
FinderProvider,
|
|
45
|
+
LivePanelOptions,
|
|
46
|
+
} from "./finder.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference path="
|
|
1
|
+
/// <reference path="./fresh.d.ts" />
|
|
2
2
|
|
|
3
3
|
import type { PanelOptions, PanelState } from "./types.ts";
|
|
4
4
|
|
|
@@ -107,7 +107,7 @@ export class PanelManager {
|
|
|
107
107
|
this.state.sourceBufferId = this.editor.getActiveBufferId();
|
|
108
108
|
|
|
109
109
|
// Create virtual buffer in split
|
|
110
|
-
const
|
|
110
|
+
const result = await this.editor.createVirtualBufferInSplit({
|
|
111
111
|
name: this.panelName,
|
|
112
112
|
mode: this.modeName,
|
|
113
113
|
read_only: true,
|
|
@@ -119,11 +119,11 @@ export class PanelManager {
|
|
|
119
119
|
});
|
|
120
120
|
|
|
121
121
|
// Track state
|
|
122
|
-
this.state.bufferId =
|
|
123
|
-
this.state.splitId = this.editor.getActiveSplitId();
|
|
122
|
+
this.state.bufferId = result.buffer_id;
|
|
123
|
+
this.state.splitId = result.split_id ?? this.editor.getActiveSplitId();
|
|
124
124
|
this.state.isOpen = true;
|
|
125
125
|
|
|
126
|
-
return
|
|
126
|
+
return result.buffer_id;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
@@ -204,15 +204,9 @@ export class PanelManager {
|
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// Focus source split and open file
|
|
207
|
+
// Focus source split and open file at location
|
|
208
208
|
this.editor.focusSplit(this.state.sourceSplitId);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// Jump to location
|
|
212
|
-
this.editor.gotoLine(line);
|
|
213
|
-
if (column > 1) {
|
|
214
|
-
this.editor.gotoColumn(column);
|
|
215
|
-
}
|
|
209
|
+
this.editor.openFile(filePath, line, column);
|
|
216
210
|
|
|
217
211
|
// Focus back on panel
|
|
218
212
|
this.focusPanel();
|