@fresh-editor/fresh-editor 0.1.75 → 0.1.76
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 +26 -0
- package/README.md +6 -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 +44 -2
- 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_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 +93 -17
- package/plugins/lib/index.ts +14 -0
- 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/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/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
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get the i18n helper object (for compatibility)
|
|
73
|
+
* @returns Object with t() method bound to this plugin
|
|
74
|
+
*/
|
|
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
|
+
|
|
50
121
|
/**
|
|
51
|
-
*
|
|
122
|
+
* Get the theme JSON Schema (with proper typing)
|
|
52
123
|
*/
|
|
53
|
-
|
|
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
|
/**
|
|
@@ -309,7 +388,7 @@ interface TsCompositeLayoutConfig {
|
|
|
309
388
|
/** Show separator between panes */
|
|
310
389
|
show_separator?: boolean | null;
|
|
311
390
|
/** Spacing between stacked panes */
|
|
312
|
-
spacing?:
|
|
391
|
+
spacing?: number | null;
|
|
313
392
|
}
|
|
314
393
|
|
|
315
394
|
/** Pane style configuration */
|
|
@@ -515,7 +594,7 @@ interface EditorAPI {
|
|
|
515
594
|
* @param process_id - ID returned from spawnBackgroundProcess
|
|
516
595
|
* @returns true if process is running, false if not found or exited
|
|
517
596
|
*/
|
|
518
|
-
isProcessRunning(
|
|
597
|
+
isProcessRunning(process_id: number): boolean;
|
|
519
598
|
/** Compute syntax highlighting for a buffer range */
|
|
520
599
|
getHighlights(buffer_id: number, start: number, end: number): Promise<TsHighlightSpan[]>;
|
|
521
600
|
/** Get diff vs last saved snapshot for a buffer */
|
|
@@ -686,7 +765,7 @@ interface EditorAPI {
|
|
|
686
765
|
* @param priority - Priority for ordering multiple lines at same position
|
|
687
766
|
* @returns true if virtual line was added
|
|
688
767
|
*/
|
|
689
|
-
addVirtualLine(buffer_id: number, position: number, text: string, fg_r: number, fg_g: number, fg_b: number, bg_r:
|
|
768
|
+
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
769
|
/**
|
|
691
770
|
* Set a line indicator in the gutter's indicator column
|
|
692
771
|
* @param buffer_id - The buffer ID
|
|
@@ -793,14 +872,14 @@ interface EditorAPI {
|
|
|
793
872
|
* @param process_id - ID returned from spawnBackgroundProcess or spawnProcessStart
|
|
794
873
|
* @returns true if process was killed, false if not found
|
|
795
874
|
*/
|
|
796
|
-
killProcess(
|
|
875
|
+
killProcess(process_id: number): Promise<boolean>;
|
|
797
876
|
/**
|
|
798
877
|
* Wait for a cancellable process to complete and get its result
|
|
799
878
|
*
|
|
800
879
|
* @param process_id - ID returned from spawnProcessStart
|
|
801
880
|
* @returns SpawnResult with stdout, stderr, and exit_code
|
|
802
881
|
*/
|
|
803
|
-
spawnProcessWait(
|
|
882
|
+
spawnProcessWait(process_id: number): Promise<SpawnResult>;
|
|
804
883
|
/**
|
|
805
884
|
* Delay execution for a specified number of milliseconds
|
|
806
885
|
*
|
|
@@ -809,7 +888,7 @@ interface EditorAPI {
|
|
|
809
888
|
* @example
|
|
810
889
|
* await editor.delay(100); // Wait 100ms
|
|
811
890
|
*/
|
|
812
|
-
delay(
|
|
891
|
+
delay(ms: number): Promise<void>;
|
|
813
892
|
/** Find a buffer ID by its file path */
|
|
814
893
|
findBufferByPath(path: string): number;
|
|
815
894
|
/**
|
|
@@ -827,7 +906,7 @@ interface EditorAPI {
|
|
|
827
906
|
* This is a safe operation that prevents plugins from deleting arbitrary files.
|
|
828
907
|
* @param name - Theme name (without .json extension)
|
|
829
908
|
*/
|
|
830
|
-
deleteTheme(name: string): Promise<
|
|
909
|
+
deleteTheme(name: string): Promise<void>;
|
|
831
910
|
/**
|
|
832
911
|
* Create a composite buffer that displays multiple source buffers
|
|
833
912
|
*
|
|
@@ -946,7 +1025,7 @@ interface EditorAPI {
|
|
|
946
1025
|
* Anchors map corresponding line numbers between left and right buffers.
|
|
947
1026
|
* Each anchor is a tuple of (left_line, right_line).
|
|
948
1027
|
*/
|
|
949
|
-
setScrollSyncAnchors(group_id: number, anchors:
|
|
1028
|
+
setScrollSyncAnchors(group_id: number, anchors: [number, number][]): boolean;
|
|
950
1029
|
/** Remove a scroll sync group */
|
|
951
1030
|
removeScrollSyncGroup(group_id: number): boolean;
|
|
952
1031
|
|
|
@@ -989,7 +1068,7 @@ interface EditorAPI {
|
|
|
989
1068
|
* @param extend_to_line_end - Extend background to end of visual line
|
|
990
1069
|
* @returns true if overlay was added
|
|
991
1070
|
*/
|
|
992
|
-
addOverlay(buffer_id: number, namespace: string, start: number, end: number, r: number, g: number, b: number, bg_r:
|
|
1071
|
+
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
1072
|
/**
|
|
994
1073
|
* Remove a specific overlay by its handle
|
|
995
1074
|
* @param buffer_id - The buffer ID
|
|
@@ -1076,7 +1155,7 @@ interface EditorAPI {
|
|
|
1076
1155
|
* @param path - Destination path (absolute or relative to cwd)
|
|
1077
1156
|
* @param content - UTF-8 string to write
|
|
1078
1157
|
*/
|
|
1079
|
-
writeFile(path: string, content: string): Promise<
|
|
1158
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
1080
1159
|
/**
|
|
1081
1160
|
* Check if a path exists (file, directory, or symlink)
|
|
1082
1161
|
*
|
|
@@ -1264,7 +1343,7 @@ interface EditorAPI {
|
|
|
1264
1343
|
* ["q", "close_buffer"]
|
|
1265
1344
|
* ], true);
|
|
1266
1345
|
*/
|
|
1267
|
-
defineMode(name: string, parent: string, bindings:
|
|
1346
|
+
defineMode(name: string, parent: string, bindings: [string, string][], read_only: boolean): boolean;
|
|
1268
1347
|
/**
|
|
1269
1348
|
* Switch the current split to display a buffer
|
|
1270
1349
|
* @param buffer_id - ID of the buffer to show
|
|
@@ -1316,6 +1395,3 @@ interface EditorAPI {
|
|
|
1316
1395
|
setVirtualBufferContent(buffer_id: number, entries: TextPropertyEntry[]): boolean;
|
|
1317
1396
|
|
|
1318
1397
|
}
|
|
1319
|
-
|
|
1320
|
-
// Export for module compatibility
|
|
1321
|
-
export {};
|
package/plugins/lib/index.ts
CHANGED
|
@@ -22,3 +22,17 @@ export { NavigationController } from "./navigation-controller.ts";
|
|
|
22
22
|
// Buffer Creation
|
|
23
23
|
export { createVirtualBufferFactory } from "./virtual-buffer-factory.ts";
|
|
24
24
|
export type { VirtualBufferOptions, SplitBufferOptions } from "./virtual-buffer-factory.ts";
|
|
25
|
+
|
|
26
|
+
// Finder Abstraction
|
|
27
|
+
export { Finder, defaultFuzzyFilter, parseGrepLine, parseGrepOutput, getRelativePath, createLiveProvider } from "./finder.ts";
|
|
28
|
+
export type {
|
|
29
|
+
DisplayEntry,
|
|
30
|
+
SearchSource,
|
|
31
|
+
FilterSource,
|
|
32
|
+
PreviewConfig,
|
|
33
|
+
FinderConfig,
|
|
34
|
+
PromptOptions,
|
|
35
|
+
PanelOptions as FinderPanelOptions,
|
|
36
|
+
FinderProvider,
|
|
37
|
+
LivePanelOptions,
|
|
38
|
+
} 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();
|