deck-plugin-sdk 0.22.0 → 1.2.0
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/build-plugin.mjs +150 -143
- package/package.json +1 -1
- package/shim/bridge.js +8 -0
- package/shim/p2p.d.ts +4 -0
- package/shim/p2p.js +15 -0
- package/shim/react-dom.js +19 -0
- package/shim/settings.d.ts +1 -1
- package/shim/settings.js +3 -0
- package/shim/terminals.d.ts +1 -1
- package/shim/ui.d.ts +10 -0
- package/shim/ui.js +47 -0
- package/template/plugin.json +9 -8
- package/types/components/ActivityBar.d.ts +20 -0
- package/types/components/ContextMenu.d.ts +3 -1
- package/types/components/FileIcon.d.ts +7 -0
- package/types/components/TabStrip.d.ts +7 -1
- package/types/components/menuplace.d.ts +7 -1
- package/types/components/useResize.d.ts +12 -0
- package/types/core/bridge.d.ts +37 -1
- package/types/core/dap.d.ts +181 -0
- package/types/core/decode.d.ts +13 -0
- package/types/core/icontheme.d.ts +28 -0
- package/types/core/inlay.d.ts +37 -0
- package/types/core/keys.d.ts +1 -1
- package/types/core/keystore.d.ts +16 -2
- package/types/core/lsp.d.ts +193 -0
- package/types/core/p2p.d.ts +117 -0
- package/types/core/patterntokens.d.ts +24 -0
- package/types/core/remotepath.d.ts +17 -0
- package/types/core/settingsstore.d.ts +1 -0
- package/types/core/snippets.d.ts +15 -0
- package/types/core/timeFormat.d.ts +12 -0
- package/types/modules/editor/MonacoHosts.d.ts +80 -0
- package/types/modules/editor/annotations.d.ts +2 -0
- package/types/modules/editor/diffline.d.ts +13 -0
- package/types/modules/editor/editorstatus.d.ts +16 -0
- package/types/modules/editor/models.d.ts +8 -0
- package/types/modules/editor/tree.d.ts +59 -0
- package/types/modules/editor/viewers.d.ts +41 -0
package/types/core/bridge.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface Settings {
|
|
|
42
42
|
closeToTray: boolean;
|
|
43
43
|
startMinimized: boolean;
|
|
44
44
|
reduceMotion: boolean;
|
|
45
|
+
/** The Servers list (hosts from ~/.ssh/config) under the workspace list. */
|
|
46
|
+
serversList: boolean;
|
|
45
47
|
soundOnFire: boolean;
|
|
46
48
|
playerPlacement: "fixed" | "floating";
|
|
47
49
|
accent: AccentColor;
|
|
@@ -74,13 +76,23 @@ export interface Settings {
|
|
|
74
76
|
/** Drawer tabs left-to-right. Ids missing from it keep their discovery order, after the rest. */
|
|
75
77
|
drawerOrder: string[];
|
|
76
78
|
httpMcpRevealSecrets: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* What to call the user: shown to the others when sharing (a Canvas board's cursor and the
|
|
81
|
+
* host's "wants to join"). "" means work it out: the Google account's name when signed in,
|
|
82
|
+
* else the Windows account's (see `userName` in settingsstore.ts).
|
|
83
|
+
*/
|
|
84
|
+
userName: string;
|
|
77
85
|
}
|
|
78
86
|
export declare const DEFAULT_SETTINGS: Settings;
|
|
79
87
|
export declare const setAutostart: (on: boolean) => Promise<void>;
|
|
80
88
|
export declare const getAutostart: () => Promise<boolean>;
|
|
81
89
|
export declare const toggleFullscreen: () => Promise<boolean>;
|
|
82
90
|
export declare const isFullscreen: () => Promise<boolean>;
|
|
83
|
-
/**
|
|
91
|
+
/** Check a sudo password on the server and hold it until Deck exits (never written anywhere). */
|
|
92
|
+
export declare const remoteSudoPassword: (host: string, password: string) => Promise<void>;
|
|
93
|
+
/** Ask for the sudo password of `host` (SudoPasswordPrompt, mounted in App). True once it has
|
|
94
|
+
* been accepted, false if the prompt was cancelled. */
|
|
95
|
+
export declare function askSudoPassword(host: string): Promise<boolean>;
|
|
84
96
|
export declare const watchFiles: (paths: string[]) => Promise<void>;
|
|
85
97
|
/** RAM in bytes: Deck and its WebView2 children, plus every claude.exe. */
|
|
86
98
|
export interface MemServer {
|
|
@@ -171,6 +183,18 @@ export interface HttpSendResult {
|
|
|
171
183
|
* that does need to cancel should use core/httpclient.ts, which owns that id.
|
|
172
184
|
*/
|
|
173
185
|
export declare const httpSend: (req: HttpSendRequest) => Promise<HttpSendResult>;
|
|
186
|
+
/**
|
|
187
|
+
* The same send under an id the caller chose, so it can be cancelled with `httpCancel` while in
|
|
188
|
+
* flight. `req` is the full shape http.rs takes; the Requests plugin builds it.
|
|
189
|
+
*/
|
|
190
|
+
export declare const httpSendAs: <T = HttpSendResult>(id: string, req: object) => Promise<T>;
|
|
191
|
+
/** Abort the send started under `id`. A no-op when it has already finished. */
|
|
192
|
+
export declare const httpCancel: (id: string) => Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Answer an `http-send` event: a send the MCP asked for through sessions.rs, which waits on this
|
|
195
|
+
* reply under `job`. The Requests plugin listens for the event and does the send.
|
|
196
|
+
*/
|
|
197
|
+
export declare const httpSendReply: (job: string, body: string) => Promise<void>;
|
|
174
198
|
export interface DownloadItem {
|
|
175
199
|
id: string;
|
|
176
200
|
url: string;
|
|
@@ -365,6 +389,18 @@ export declare const fsRead: (path: string) => Promise<string>;
|
|
|
365
389
|
/** Raw bytes, for a file that is not text — fsRead decodes as UTF-8 and would corrupt it. */
|
|
366
390
|
export declare const fsReadBytes: (path: string) => Promise<Uint8Array<ArrayBuffer>>;
|
|
367
391
|
export declare const fsSize: (path: string) => Promise<number>;
|
|
392
|
+
/** What is at a remote path. A missing one is `exists: false`, not an error. */
|
|
393
|
+
export interface RemoteStat {
|
|
394
|
+
exists: boolean;
|
|
395
|
+
dir: boolean;
|
|
396
|
+
size: number;
|
|
397
|
+
mtimeMs: number;
|
|
398
|
+
}
|
|
399
|
+
export declare const remoteStat: (path: string) => Promise<RemoteStat>;
|
|
400
|
+
/** The server's home folder as host:/home/user (host+sudo: when it runs as root). */
|
|
401
|
+
export declare const remoteHome: (host: string, sudo: boolean) => Promise<string>;
|
|
402
|
+
/** Host names from ~/.ssh/config, without patterns. */
|
|
403
|
+
export declare const sshHosts: () => Promise<string[]>;
|
|
368
404
|
export declare const fsWrite: (path: string, content: string) => Promise<void>;
|
|
369
405
|
/** Raw bytes — saving a response that is an image or a PDF, which a string would corrupt. */
|
|
370
406
|
export declare const fsWriteBytes: (path: string, bytes: Uint8Array) => Promise<void>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** How to launch an adapter: a language's `debug.adapter` block, resolved by lsp.rs's rules. */
|
|
3
|
+
export interface AdapterSpec {
|
|
4
|
+
strategy: string;
|
|
5
|
+
command?: string;
|
|
6
|
+
module?: string;
|
|
7
|
+
args?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface Transport {
|
|
10
|
+
start(adapter: AdapterSpec, cwd: string): Promise<string>;
|
|
11
|
+
/** Another connection to a server adapter: the child session a `startDebugging` asks for. */
|
|
12
|
+
connect(parent: string): Promise<string>;
|
|
13
|
+
send(session: string, body: string): void;
|
|
14
|
+
stop(session: string): void;
|
|
15
|
+
/** Called once, before the first start: every message and every exit, for every session. */
|
|
16
|
+
listen(onMessage: (session: string, body: string) => void, onExit: (session: string) => void): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const tauriTransport: Transport;
|
|
19
|
+
export interface Frame {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
line: number;
|
|
24
|
+
column: number;
|
|
25
|
+
}
|
|
26
|
+
export interface Variable {
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
ref: number;
|
|
31
|
+
}
|
|
32
|
+
export interface OutputLine {
|
|
33
|
+
id: number;
|
|
34
|
+
category: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}
|
|
37
|
+
/** A line breakpoint as the editor holds it. `verified` and `line` are the adapter's answer. */
|
|
38
|
+
export interface Breakpoint {
|
|
39
|
+
line: number;
|
|
40
|
+
condition?: string;
|
|
41
|
+
verified?: boolean;
|
|
42
|
+
message?: string;
|
|
43
|
+
/** false: switched off, kept in the list and the gutter but not sent to the adapter. */
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type Status = "starting" | "running" | "paused" | "ended";
|
|
47
|
+
export interface DebugState {
|
|
48
|
+
/** The session, or null when nothing is being debugged. Ended sessions stay until the next start. */
|
|
49
|
+
session: null | {
|
|
50
|
+
/** The connection requests go to: the adapter's, or the newest child session's. */
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* Every connection of this session, the adapter's first. js-debug answers a launch by asking
|
|
54
|
+
* for a child session (`startDebugging`) on a second connection, and the program's stops,
|
|
55
|
+
* stack and variables are all on that one; the first is what ends the whole tree.
|
|
56
|
+
*/
|
|
57
|
+
conns: string[];
|
|
58
|
+
name: string;
|
|
59
|
+
status: Status;
|
|
60
|
+
/** The thread that stopped, for every request that needs one (Dart isolates are threads). */
|
|
61
|
+
threadId?: number;
|
|
62
|
+
/** Why it paused: "breakpoint", "step", "exception", "pause", "entry". */
|
|
63
|
+
reason?: string;
|
|
64
|
+
/** The stopped thread's stack, top first. Empty while running. */
|
|
65
|
+
frames: Frame[];
|
|
66
|
+
/** The frame being looked at (index into `frames`): the top one on each stop, or a picked one. */
|
|
67
|
+
frame: number;
|
|
68
|
+
/** Counts stops, so a view of variables can tell this pause from the last one at the same line. */
|
|
69
|
+
stops: number;
|
|
70
|
+
/** The exception filters the adapter offers ("All", "Unhandled" for Dart), from `initialize`. */
|
|
71
|
+
filters: {
|
|
72
|
+
filter: string;
|
|
73
|
+
label: string;
|
|
74
|
+
default?: boolean;
|
|
75
|
+
}[];
|
|
76
|
+
/** The adapter's language ("dart", "python"): exception choices are kept per language. */
|
|
77
|
+
type: string;
|
|
78
|
+
/** A launched program ends with the session; an attached one is only detached. */
|
|
79
|
+
request: "launch" | "attach";
|
|
80
|
+
/** A stop on an exception: what was thrown, as the adapter describes it. */
|
|
81
|
+
description?: string;
|
|
82
|
+
error?: string;
|
|
83
|
+
/** The language, when the start said (for its debugger's Install button). */
|
|
84
|
+
languageId?: string;
|
|
85
|
+
/** The adapter never started or never answered: it is, most likely, not installed. */
|
|
86
|
+
notInstalled?: boolean;
|
|
87
|
+
};
|
|
88
|
+
output: OutputLine[];
|
|
89
|
+
/** The exception filters switched on, or null for the adapter's defaults. Kept across sessions. */
|
|
90
|
+
/**
|
|
91
|
+
* The exception filters switched on, per adapter type, or absent for that adapter's defaults.
|
|
92
|
+
* Per type because each adapter names its own ("Unhandled" for Dart, "uncaught" for Python).
|
|
93
|
+
*/
|
|
94
|
+
exceptionFilters: Record<string, string[]>;
|
|
95
|
+
/** Breakpoints by file path, as the editor set them. */
|
|
96
|
+
breakpoints: Record<string, Breakpoint[]>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The key a file's breakpoints are kept under: backslashes, as Windows tools and the adapter write
|
|
100
|
+
* paths. Two spellings of one file (slash direction, drive-letter case) must not hold two lists.
|
|
101
|
+
*/
|
|
102
|
+
export declare const bpKey: (path: string) => string;
|
|
103
|
+
/** Whether two paths name the same file (Windows: case-insensitive). */
|
|
104
|
+
export declare const samePath: (a: string, b: string) => boolean;
|
|
105
|
+
/** What a start needs: the adapter, where to run it, and the launch or attach arguments. */
|
|
106
|
+
export interface StartOptions {
|
|
107
|
+
name: string;
|
|
108
|
+
adapter: AdapterSpec;
|
|
109
|
+
cwd: string;
|
|
110
|
+
request: "launch" | "attach";
|
|
111
|
+
/** Passed to the adapter as the request's arguments (a launch.json configuration, more or less). */
|
|
112
|
+
args: Record<string, unknown>;
|
|
113
|
+
adapterId?: string;
|
|
114
|
+
/** What to install when the adapter will not start (language.json `debug.install`), in words. */
|
|
115
|
+
install?: string;
|
|
116
|
+
/** The language being debugged, so the panel can offer its debugger's Install button. */
|
|
117
|
+
languageId?: string;
|
|
118
|
+
}
|
|
119
|
+
type Msg = {
|
|
120
|
+
seq: number;
|
|
121
|
+
type: string;
|
|
122
|
+
request_seq?: number;
|
|
123
|
+
success?: boolean;
|
|
124
|
+
message?: string;
|
|
125
|
+
command?: string;
|
|
126
|
+
event?: string;
|
|
127
|
+
body?: Record<string, unknown>;
|
|
128
|
+
};
|
|
129
|
+
export declare function createDebugger(transport: Transport): {
|
|
130
|
+
subscribe: (fn: () => void) => () => void;
|
|
131
|
+
getState: () => DebugState;
|
|
132
|
+
start: (o: StartOptions) => Promise<void>;
|
|
133
|
+
stop: (terminate?: boolean) => Promise<void>;
|
|
134
|
+
continue: () => Promise<Msg>;
|
|
135
|
+
next: () => Promise<Msg>;
|
|
136
|
+
stepIn: () => Promise<Msg>;
|
|
137
|
+
stepOut: () => Promise<Msg>;
|
|
138
|
+
pause: () => Promise<Msg>;
|
|
139
|
+
/** The scopes of a frame (Locals, Globals…), each with the reference its variables are read by. */
|
|
140
|
+
scopes(frameId: number): Promise<{
|
|
141
|
+
name: string;
|
|
142
|
+
ref: number;
|
|
143
|
+
}[]>;
|
|
144
|
+
variables: (ref: number) => Promise<Variable[]>;
|
|
145
|
+
/** Evaluate in a frame: `watch` for the watch list, `repl` for the console, `hover` for the editor. */
|
|
146
|
+
evaluate(expression: string, frameId?: number, context?: "watch" | "repl" | "hover"): Promise<{
|
|
147
|
+
value: string;
|
|
148
|
+
ref: number;
|
|
149
|
+
error?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
error: string;
|
|
152
|
+
value?: undefined;
|
|
153
|
+
ref?: undefined;
|
|
154
|
+
}>;
|
|
155
|
+
/** Replace a file's breakpoints, and tell the adapter if a session is running. */
|
|
156
|
+
setBreakpoints: (path: string, list: Breakpoint[]) => void;
|
|
157
|
+
/** Add a breakpoint on a line, or remove the one there. */
|
|
158
|
+
toggleBreakpoint(path: string, line: number): void;
|
|
159
|
+
/** Set or clear a line's condition, adding the breakpoint if there is none. */
|
|
160
|
+
setCondition(path: string, line: number, condition: string): void;
|
|
161
|
+
/** Switch a breakpoint on or off without removing it. */
|
|
162
|
+
setEnabled(path: string, line: number, on: boolean): void;
|
|
163
|
+
/**
|
|
164
|
+
* The breakpoints' lines after an edit moved them. `lines` is in the order of the file's
|
|
165
|
+
* breakpoints; two that edits brought onto one line become one.
|
|
166
|
+
*/
|
|
167
|
+
moveBreakpoints(path: string, lines: (number | undefined)[]): void;
|
|
168
|
+
breakpointsFor: (path: string) => Breakpoint[];
|
|
169
|
+
/** Look at another frame of the stopped thread's stack (the call stack's click). */
|
|
170
|
+
selectFrame(i: number): void;
|
|
171
|
+
clearOutput: () => void;
|
|
172
|
+
activeFilters: () => string[];
|
|
173
|
+
/** Choose which exceptions pause the program; remembered, and sent to a running adapter. */
|
|
174
|
+
setExceptionFilters(filters: string[]): void;
|
|
175
|
+
/** The debug console's input: echo it, evaluate it in the frame being looked at, print the answer. */
|
|
176
|
+
repl(expression: string): Promise<void>;
|
|
177
|
+
};
|
|
178
|
+
export type Debugger = ReturnType<typeof createDebugger>;
|
|
179
|
+
/** Deck's debugger. */
|
|
180
|
+
export declare const debug: Debugger;
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Text from a file's bytes, by its byte-order mark: UTF-16 when it has one (what `>` writes in
|
|
4
|
+
* Windows PowerShell 5.1), else UTF-8, else the Windows code page.
|
|
5
|
+
*
|
|
6
|
+
* `utf8` is false when the bytes are not UTF-8, so writing the text back (which Deck always does
|
|
7
|
+
* as UTF-8) would change the file's encoding. A UTF-8 BOM is kept in the text, as `fs_read` and
|
|
8
|
+
* the git text commands keep it, so the same file reads the same either way.
|
|
9
|
+
*/
|
|
10
|
+
export declare function decodeText(b: Uint8Array): {
|
|
11
|
+
text: string;
|
|
12
|
+
utf8: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { type LucideIcon } from "lucide-react";
|
|
3
|
+
import { type ImportedPack } from "./bridge";
|
|
4
|
+
export type IconRef = {
|
|
5
|
+
kind: "lucide";
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "url";
|
|
9
|
+
name: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "src";
|
|
12
|
+
src: string;
|
|
13
|
+
};
|
|
14
|
+
export interface IconTheme {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
file(name: string): IconRef;
|
|
18
|
+
folder(name: string, open: boolean): IconRef;
|
|
19
|
+
}
|
|
20
|
+
export declare const ICON_THEMES: Record<string, IconTheme>;
|
|
21
|
+
export declare function listPacks(): Promise<ImportedPack[]>;
|
|
22
|
+
export declare function loadImportedThemes(): Promise<void>;
|
|
23
|
+
export declare function addPack(pack: ImportedPack): Promise<void>;
|
|
24
|
+
export declare function removePack(id: string): Promise<void>;
|
|
25
|
+
export declare function allThemes(): IconTheme[];
|
|
26
|
+
export declare function themeById(id: string): IconTheme;
|
|
27
|
+
export declare function resolveIconUrl(svgName: string): Promise<string | null>;
|
|
28
|
+
export declare function useIconThemesVersion(): number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** Which hints the editor shows: Settings → Editor → Display. */
|
|
3
|
+
export type InlayShow = "all" | "types" | "parameters" | "off";
|
|
4
|
+
export interface HintPart<U> {
|
|
5
|
+
label: string;
|
|
6
|
+
tooltip?: string | {
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
location?: {
|
|
10
|
+
uri: U;
|
|
11
|
+
range: {
|
|
12
|
+
startLineNumber: number;
|
|
13
|
+
startColumn: number;
|
|
14
|
+
endLineNumber: number;
|
|
15
|
+
endColumn: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface Hint<U> {
|
|
20
|
+
label: string | HintPart<U>[];
|
|
21
|
+
position: {
|
|
22
|
+
lineNumber: number;
|
|
23
|
+
column: number;
|
|
24
|
+
};
|
|
25
|
+
kind?: number;
|
|
26
|
+
paddingLeft?: boolean;
|
|
27
|
+
paddingRight?: boolean;
|
|
28
|
+
tooltip?: string | {
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Monaco's hints for a `textDocument/inlayHint` reply, keeping only the kinds `show` asks for.
|
|
34
|
+
* LSP positions are 0-based and Monaco's 1-based. A hint with no kind (a server may send one) is
|
|
35
|
+
* kept by "all" and dropped by a filter, since it cannot be said to be either.
|
|
36
|
+
*/
|
|
37
|
+
export declare function toInlayHints<U>(reply: any, show: InlayShow, toUri: (uri: string) => U): Hint<U>[];
|
package/types/core/keys.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* It is also what lets two bindings share a chord honestly — the editor's save and a terminal
|
|
11
11
|
* action can both be Ctrl+S if the two surfaces never have the keyboard at the same time.
|
|
12
12
|
*/
|
|
13
|
-
export type Scope = "app" | "workspaces" | "editor" | "
|
|
13
|
+
export type Scope = "app" | "workspaces" | "editor" | "terminal" | `plugin:${string}`;
|
|
14
14
|
/** Which thing owns the chord. Absent means a plain window listener. */
|
|
15
15
|
export type Surface = "monaco" | "xterm" | "codemirror";
|
|
16
16
|
export interface KeyBinding {
|
package/types/core/keystore.d.ts
CHANGED
|
@@ -38,9 +38,23 @@ export type KeyAction = (() => void) | {
|
|
|
38
38
|
export declare function onKey(id: string, run: () => void, when?: () => boolean): () => void;
|
|
39
39
|
/** Register several at once — what a module with a dozen chords wants. */
|
|
40
40
|
export declare function onKeys(map: Record<string, KeyAction>): () => void;
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Claim a scope. `holds` says whether the claim counts right now (default: always). Returns a
|
|
43
|
+
* disposer.
|
|
44
|
+
*/
|
|
45
|
+
export declare function pushScope(scope: Scope, holds?: () => boolean): () => void;
|
|
43
46
|
export declare function activeScopes(): ReadonlySet<Scope>;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the tool being rendered has the keyboard. A pane provides one that answers "is focus in
|
|
49
|
+
* me" (see ContentPane in Terminals.tsx); outside any pane a tool owns the window and always has it.
|
|
50
|
+
*
|
|
51
|
+
* Without this, a tool's shortcuts were live wherever focus was the moment it mounted, and a
|
|
52
|
+
* terminal swallows every chord something else has claimed, so an HTTP pane on screen took
|
|
53
|
+
* Ctrl+Enter away from the shell beside it.
|
|
54
|
+
*/
|
|
55
|
+
export declare const ScopeGate: import("react").Context<() => boolean>;
|
|
56
|
+
/** Claim `scope` for as long as the component is mounted, while its pane (if any) has focus. */
|
|
57
|
+
export declare function useScope(scope: Scope): void;
|
|
44
58
|
/**
|
|
45
59
|
* Run whatever this event is bound to, and say whether anything did.
|
|
46
60
|
*
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { monaco } from "./monaco";
|
|
3
|
+
/** How to launch the server — passed straight to Rust, which implements the strategies. */
|
|
4
|
+
interface ServerSpec {
|
|
5
|
+
/** "path" | "node-module" | "exe-search" — see resolve_server() in lsp.rs. */
|
|
6
|
+
strategy: string;
|
|
7
|
+
command?: string;
|
|
8
|
+
module?: string;
|
|
9
|
+
args?: string[];
|
|
10
|
+
/** How to install the server, for the Install button in Settings › Languages. */
|
|
11
|
+
install?: Install;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What to install for a server or a debugger, as one of a few kinds Deck turns into a command
|
|
15
|
+
* itself (tools.rs): a definition from the registry never names a command to run.
|
|
16
|
+
*/
|
|
17
|
+
export type InstallSpec = {
|
|
18
|
+
kind: "pip" | "npm";
|
|
19
|
+
packages: string[];
|
|
20
|
+
} | {
|
|
21
|
+
kind: "github-release";
|
|
22
|
+
name: string;
|
|
23
|
+
repo: string;
|
|
24
|
+
tag: string;
|
|
25
|
+
asset: string;
|
|
26
|
+
sha256: string;
|
|
27
|
+
};
|
|
28
|
+
/** A structured install, or a sentence for what Deck cannot install itself (an SDK). */
|
|
29
|
+
export type Install = InstallSpec | string;
|
|
30
|
+
/** An install as one sentence, for where a button would not fit or there is nothing to run. */
|
|
31
|
+
export declare function installText(i: Install): string;
|
|
32
|
+
/** Whether Deck can run it (an Install button), rather than only describe it. */
|
|
33
|
+
export declare const canInstall: (i: Install | undefined) => i is InstallSpec;
|
|
34
|
+
/** A language's server or debugger install entry, if its definition has one. */
|
|
35
|
+
export declare function installFor(languageId: string, what: "server" | "debug"): Install | undefined;
|
|
36
|
+
/** A language's debug adapter, or null when its definition names none (or there is no such language). */
|
|
37
|
+
export declare function debugAdapterFor(languageId: string): {
|
|
38
|
+
adapter: ServerSpec;
|
|
39
|
+
type: string;
|
|
40
|
+
rootMarker: string;
|
|
41
|
+
launch?: Record<string, unknown>;
|
|
42
|
+
launchUnless?: string;
|
|
43
|
+
install?: Install;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a language's debug adapter runs on this machine: starts it and sees whether it is still
|
|
47
|
+
* running a moment later. Resolves to what was run, rejects with why not (the adapter's first line
|
|
48
|
+
* of output: Python's "No module named debugpy", Node's "Cannot find module"). Null when the
|
|
49
|
+
* language names no adapter.
|
|
50
|
+
*/
|
|
51
|
+
export declare function probeDebugger(languageId: string): Promise<string | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Load every language definition from %APPDATA%\Deck\languages.
|
|
54
|
+
*
|
|
55
|
+
* This is the ONLY source of languages. Deck used to compile a few in from src/languages/, which
|
|
56
|
+
* meant the shipped ones and a user's own obeyed different rules — one needed a rebuild to
|
|
57
|
+
* change, the other a restart, and only the first could carry snippets. Now there is one kind of
|
|
58
|
+
* language definition, and Deck ships none: an empty folder means Monaco's own highlighting and
|
|
59
|
+
* no language server, which is a coherent state rather than a broken one.
|
|
60
|
+
*
|
|
61
|
+
* Never rejects. A language that fails to load is one language that does not work; it is not a
|
|
62
|
+
* reason for the editor not to start, and the same contract loadPlugins states.
|
|
63
|
+
*/
|
|
64
|
+
export declare function loadExternalLanguages(): Promise<void>;
|
|
65
|
+
/** One language, as Settings lists it. Flattened from its LangDef — the panel shows what a
|
|
66
|
+
* definition claims, not the definition itself. */
|
|
67
|
+
export interface LoadedLanguage {
|
|
68
|
+
languageId: string;
|
|
69
|
+
serverId: string;
|
|
70
|
+
extensions: string[];
|
|
71
|
+
rootMarker: string;
|
|
72
|
+
strategy: string;
|
|
73
|
+
/** The command or node module the strategy will look for. */
|
|
74
|
+
command: string;
|
|
75
|
+
/** The folder it came from, which is the name to look for on disk. */
|
|
76
|
+
folder: string;
|
|
77
|
+
/** language.json's version, or "" when it has none (a pack from before versions). */
|
|
78
|
+
version: string;
|
|
79
|
+
/** Its lucide icon name and colour from language.json; "" when it names none. */
|
|
80
|
+
icon: string;
|
|
81
|
+
color: string;
|
|
82
|
+
snippets?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface LanguageError {
|
|
85
|
+
folder: string;
|
|
86
|
+
message: string;
|
|
87
|
+
}
|
|
88
|
+
/** Every language definition that loaded. */
|
|
89
|
+
export declare function loadedLanguages(): readonly LoadedLanguage[];
|
|
90
|
+
/**
|
|
91
|
+
* Re-read the languages folder whenever it changes on disk. Called once at startup.
|
|
92
|
+
*
|
|
93
|
+
* What makes installing a language from the registry take effect without a restart, the same way
|
|
94
|
+
* the plugin watcher does for a plugin. Debounced: writing a definition and its snippets emits
|
|
95
|
+
* several events, and each would otherwise re-read the whole folder.
|
|
96
|
+
*
|
|
97
|
+
* Only NEW definitions and changed data are picked up. A language whose server is already
|
|
98
|
+
* running keeps that session — lsp.rs owns it, and restarting one because a snippet file changed
|
|
99
|
+
* would lose whatever it had analysed.
|
|
100
|
+
*/
|
|
101
|
+
export declare function watchLanguages(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Whether a language's server is actually installed, without opening a file of that type.
|
|
104
|
+
*
|
|
105
|
+
* Until this existed, a definition naming a server you do not have was only discoverable by
|
|
106
|
+
* opening such a file and reading the error — so "Python needs basedpyright installed" was
|
|
107
|
+
* something Deck knew and never said.
|
|
108
|
+
*
|
|
109
|
+
* `root` is optional and usually empty: a node module resolves from the project's node_modules
|
|
110
|
+
* first, so a check with no project answers "is it installed globally".
|
|
111
|
+
*/
|
|
112
|
+
export declare function probeLanguage(languageId: string, root?: string): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Folders that failed to load, and why.
|
|
115
|
+
*
|
|
116
|
+
* The point of surfacing these: a definition with a typo is otherwise completely silent — the
|
|
117
|
+
* language simply does not work, with nothing on screen to say a file was even read.
|
|
118
|
+
*/
|
|
119
|
+
export declare function languageErrors(): readonly LanguageError[];
|
|
120
|
+
export declare function lspSupports(languageId: string): boolean;
|
|
121
|
+
export type LspPhase = "starting" | "ready" | "error" | "stopped";
|
|
122
|
+
export interface LspStatus {
|
|
123
|
+
id: string;
|
|
124
|
+
serverId: string;
|
|
125
|
+
root: string;
|
|
126
|
+
phase: LspPhase;
|
|
127
|
+
detail: string;
|
|
128
|
+
log: string[];
|
|
129
|
+
}
|
|
130
|
+
/** React hook: current LSP server statuses (for the editor indicator). */
|
|
131
|
+
export declare function useLspStatus(): LspStatus[];
|
|
132
|
+
export declare function lspErrorVersion(): number;
|
|
133
|
+
/** Live path -> error count. Read after subscribing to changes with subscribeLspErrors. */
|
|
134
|
+
export declare function lspErrorCounts(): Map<string, number>;
|
|
135
|
+
export declare function subscribeLspErrors(cb: () => void): () => void;
|
|
136
|
+
/** Notify the server a document is open. Call when a file tab opens. */
|
|
137
|
+
export declare function lspOpenDoc(path: string, content: string, root: string): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Notify the server a document changed. Call for EVERY Monaco change, synchronously — no
|
|
140
|
+
* debounce.
|
|
141
|
+
*
|
|
142
|
+
* Under incremental sync each notification describes one edit relative to the server's current
|
|
143
|
+
* copy, so dropping or reordering any of them desynchronizes the document permanently. That is
|
|
144
|
+
* also why this is no longer debounced: a debounce necessarily drops intermediate states, which
|
|
145
|
+
* is only legal when every message carries the whole file. Sending immediately has the better
|
|
146
|
+
* property anyway — completion and hover fire on the keystroke, so under the old 300ms debounce
|
|
147
|
+
* they queried a server whose buffer was up to 300ms stale and answered for a position that did
|
|
148
|
+
* not exist there yet.
|
|
149
|
+
*
|
|
150
|
+
* `changes` comes straight from Monaco's content-change event. Its ranges are in pre-edit
|
|
151
|
+
* coordinates and it orders them end-of-document first, which is exactly what LSP expects for a
|
|
152
|
+
* sequentially-applied batch: applying a later-in-document edit never shifts an earlier range.
|
|
153
|
+
* Do not sort them.
|
|
154
|
+
*/
|
|
155
|
+
export declare function lspChangeDoc(path: string, content: string, root: string, changes?: readonly monaco.editor.IModelContentChange[]): Promise<void>;
|
|
156
|
+
/** Notify the server a document closed. Call when a tab closes. */
|
|
157
|
+
export declare function lspCloseDoc(path: string, root: string): Promise<void>;
|
|
158
|
+
/** One result of a project-wide symbol search (Ctrl+T). `line` and `col` are 1-based. */
|
|
159
|
+
export interface ProjectSymbol {
|
|
160
|
+
name: string;
|
|
161
|
+
kind: number;
|
|
162
|
+
container: string;
|
|
163
|
+
path: string;
|
|
164
|
+
line: number;
|
|
165
|
+
col: number;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Classes, functions and the rest whose name matches `query`, from every language server running
|
|
169
|
+
* for `root` (a TypeScript and a Python server can share one), each server's own ranking kept and
|
|
170
|
+
* the lists joined. Only servers already running answer: Ctrl+T does not start one. [] for an
|
|
171
|
+
* empty query.
|
|
172
|
+
*/
|
|
173
|
+
export declare function workspaceSymbols(root: string, query: string): Promise<ProjectSymbol[]>;
|
|
174
|
+
/** A file's outline from its language server, or [] when no server has it open. Also what the
|
|
175
|
+
* debugger's inline values use to find the function a frame is in. */
|
|
176
|
+
export declare function documentSymbols(model: monaco.editor.ITextModel): Promise<monaco.languages.DocumentSymbol[]>;
|
|
177
|
+
type OpenFileHandler = (path: string, line: number, column: number) => void;
|
|
178
|
+
export declare function setLspOpenFileHandler(fn: OpenFileHandler): void;
|
|
179
|
+
/** Stop the servers no project has touched for IDLE_STOP_MS. Exported for the check. */
|
|
180
|
+
export declare function stopIdleServers(now?: number): string[];
|
|
181
|
+
/** Stop all sessions (e.g. on workspace close). */
|
|
182
|
+
export declare function lspStopAll(): void;
|
|
183
|
+
/** Restart one server (UI action from the status popover). */
|
|
184
|
+
/**
|
|
185
|
+
* Stop a language server. The next file opened for that root starts a fresh one, which is why
|
|
186
|
+
* this is both the Restart action and the memory readout's stop button — there is no difference
|
|
187
|
+
* between the two beyond what the caller says about it.
|
|
188
|
+
*
|
|
189
|
+
* Deleting the frontend session alongside the process matters: leaving it would send didOpen to
|
|
190
|
+
* a dead pipe on the next open, and the editor would sit at "ready" with no diagnostics.
|
|
191
|
+
*/
|
|
192
|
+
export declare function lspRestart(id: string): Promise<void>;
|
|
193
|
+
export {};
|