deck-plugin-sdk 0.22.0 → 1.1.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.
@@ -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>[];
@@ -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" | "http" | "terminal" | "graph" | "graph-visible" | `plugin:${string}`;
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 {
@@ -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
- /** Claim a scope. Returns a disposer. */
42
- export declare function pushScope(scope: Scope): () => void;
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,190 @@
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
+ snippets?: number;
80
+ }
81
+ export interface LanguageError {
82
+ folder: string;
83
+ message: string;
84
+ }
85
+ /** Every language definition that loaded. */
86
+ export declare function loadedLanguages(): readonly LoadedLanguage[];
87
+ /**
88
+ * Re-read the languages folder whenever it changes on disk. Called once at startup.
89
+ *
90
+ * What makes installing a language from the registry take effect without a restart, the same way
91
+ * the plugin watcher does for a plugin. Debounced: writing a definition and its snippets emits
92
+ * several events, and each would otherwise re-read the whole folder.
93
+ *
94
+ * Only NEW definitions and changed data are picked up. A language whose server is already
95
+ * running keeps that session — lsp.rs owns it, and restarting one because a snippet file changed
96
+ * would lose whatever it had analysed.
97
+ */
98
+ export declare function watchLanguages(): void;
99
+ /**
100
+ * Whether a language's server is actually installed, without opening a file of that type.
101
+ *
102
+ * Until this existed, a definition naming a server you do not have was only discoverable by
103
+ * opening such a file and reading the error — so "Python needs basedpyright installed" was
104
+ * something Deck knew and never said.
105
+ *
106
+ * `root` is optional and usually empty: a node module resolves from the project's node_modules
107
+ * first, so a check with no project answers "is it installed globally".
108
+ */
109
+ export declare function probeLanguage(languageId: string, root?: string): Promise<string>;
110
+ /**
111
+ * Folders that failed to load, and why.
112
+ *
113
+ * The point of surfacing these: a definition with a typo is otherwise completely silent — the
114
+ * language simply does not work, with nothing on screen to say a file was even read.
115
+ */
116
+ export declare function languageErrors(): readonly LanguageError[];
117
+ export declare function lspSupports(languageId: string): boolean;
118
+ export type LspPhase = "starting" | "ready" | "error" | "stopped";
119
+ export interface LspStatus {
120
+ id: string;
121
+ serverId: string;
122
+ root: string;
123
+ phase: LspPhase;
124
+ detail: string;
125
+ log: string[];
126
+ }
127
+ /** React hook: current LSP server statuses (for the editor indicator). */
128
+ export declare function useLspStatus(): LspStatus[];
129
+ export declare function lspErrorVersion(): number;
130
+ /** Live path -> error count. Read after subscribing to changes with subscribeLspErrors. */
131
+ export declare function lspErrorCounts(): Map<string, number>;
132
+ export declare function subscribeLspErrors(cb: () => void): () => void;
133
+ /** Notify the server a document is open. Call when a file tab opens. */
134
+ export declare function lspOpenDoc(path: string, content: string, root: string): Promise<void>;
135
+ /**
136
+ * Notify the server a document changed. Call for EVERY Monaco change, synchronously — no
137
+ * debounce.
138
+ *
139
+ * Under incremental sync each notification describes one edit relative to the server's current
140
+ * copy, so dropping or reordering any of them desynchronizes the document permanently. That is
141
+ * also why this is no longer debounced: a debounce necessarily drops intermediate states, which
142
+ * is only legal when every message carries the whole file. Sending immediately has the better
143
+ * property anyway — completion and hover fire on the keystroke, so under the old 300ms debounce
144
+ * they queried a server whose buffer was up to 300ms stale and answered for a position that did
145
+ * not exist there yet.
146
+ *
147
+ * `changes` comes straight from Monaco's content-change event. Its ranges are in pre-edit
148
+ * coordinates and it orders them end-of-document first, which is exactly what LSP expects for a
149
+ * sequentially-applied batch: applying a later-in-document edit never shifts an earlier range.
150
+ * Do not sort them.
151
+ */
152
+ export declare function lspChangeDoc(path: string, content: string, root: string, changes?: readonly monaco.editor.IModelContentChange[]): Promise<void>;
153
+ /** Notify the server a document closed. Call when a tab closes. */
154
+ export declare function lspCloseDoc(path: string, root: string): Promise<void>;
155
+ /** One result of a project-wide symbol search (Ctrl+T). `line` and `col` are 1-based. */
156
+ export interface ProjectSymbol {
157
+ name: string;
158
+ kind: number;
159
+ container: string;
160
+ path: string;
161
+ line: number;
162
+ col: number;
163
+ }
164
+ /**
165
+ * Classes, functions and the rest whose name matches `query`, from every language server running
166
+ * for `root` (a TypeScript and a Python server can share one), each server's own ranking kept and
167
+ * the lists joined. Only servers already running answer: Ctrl+T does not start one. [] for an
168
+ * empty query.
169
+ */
170
+ export declare function workspaceSymbols(root: string, query: string): Promise<ProjectSymbol[]>;
171
+ /** A file's outline from its language server, or [] when no server has it open. Also what the
172
+ * debugger's inline values use to find the function a frame is in. */
173
+ export declare function documentSymbols(model: monaco.editor.ITextModel): Promise<monaco.languages.DocumentSymbol[]>;
174
+ type OpenFileHandler = (path: string, line: number, column: number) => void;
175
+ export declare function setLspOpenFileHandler(fn: OpenFileHandler): void;
176
+ /** Stop the servers no project has touched for IDLE_STOP_MS. Exported for the check. */
177
+ export declare function stopIdleServers(now?: number): string[];
178
+ /** Stop all sessions (e.g. on workspace close). */
179
+ export declare function lspStopAll(): void;
180
+ /** Restart one server (UI action from the status popover). */
181
+ /**
182
+ * Stop a language server. The next file opened for that root starts a fresh one, which is why
183
+ * this is both the Restart action and the memory readout's stop button — there is no difference
184
+ * between the two beyond what the caller says about it.
185
+ *
186
+ * Deleting the frontend session alongside the process matters: leaving it would send didOpen to
187
+ * a dead pipe on the next open, and the editor would sit at "ready" with no diagnostics.
188
+ */
189
+ export declare function lspRestart(id: string): Promise<void>;
190
+ export {};
@@ -0,0 +1,24 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ import * as monaco from "monaco-editor";
3
+ /** One pattern, from a language definition. */
4
+ export interface TokenPattern {
5
+ /** The semantic token type to emit — the name an extraTokenColors rule matches. */
6
+ token: string;
7
+ /**
8
+ * A regular expression, as a string, with ONE capturing group: the part to colour.
9
+ *
10
+ * The group is what makes `new\s+(\w+)` colour the class and not the keyword. A pattern with
11
+ * no group is ignored rather than colouring its whole match, because the whole match is almost
12
+ * never what was meant.
13
+ */
14
+ pattern: string;
15
+ /** Regex flags. `g` is added if absent; `i` is the only one usually wanted beyond it. */
16
+ flags?: string;
17
+ }
18
+ /**
19
+ * Register pattern-based semantic tokens for one language.
20
+ *
21
+ * Returns a disposable, so reloading a definition does not leave the previous provider behind
22
+ * emitting the old patterns alongside the new ones.
23
+ */
24
+ export declare function registerPatternTokens(languageId: string, patterns: TokenPattern[]): monaco.IDisposable | null;
@@ -0,0 +1,17 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ export interface RemotePath {
3
+ host: string;
4
+ /** File access runs through sudo on the server. */
5
+ sudo: boolean;
6
+ /** Absolute POSIX path on the server. */
7
+ path: string;
8
+ }
9
+ export declare const isRemote: (p: string) => boolean;
10
+ export declare function parseRemote(p: string): RemotePath | null;
11
+ export declare function formatRemote(r: RemotePath): string;
12
+ /** What a remote workspace is called: `vps:project`, or `vps:/` for the server's root. */
13
+ export declare function remoteLabel(p: string): string;
14
+ /** The ssh arguments that open an interactive shell in the folder. The path is single-quoted for
15
+ * the remote shell, so spaces and `$` in it are taken literally. A server that sets no $SHELL
16
+ * (minimal Alpine images) gets /bin/sh. */
17
+ export declare function sshShellArgs(p: string): string[] | null;
@@ -0,0 +1,15 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ export interface Snippet {
3
+ prefix: string;
4
+ body: string;
5
+ detail?: string;
6
+ }
7
+ /**
8
+ * Load every snippet file in one language folder's `snippets/` subfolder.
9
+ *
10
+ * Never rejects, and never throws: a language with no snippets folder is the normal case, not an
11
+ * error, and one malformed file must not cost the others in the same folder.
12
+ */
13
+ export declare function loadSnippets(languageId: string, languageDir: string): Promise<void>;
14
+ /** Snippets for a language id (empty if none dropped in for it). */
15
+ export declare function snippetsFor(languageId: string): Snippet[];
@@ -0,0 +1,12 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ /** Format an "HH:mm" (24h storage) string for display in 12h or 24h. */
3
+ export declare function fmtTime(hhmm: string, is12h: boolean): string;
4
+ /** Format an epoch-ms timestamp's clock time (with seconds) for display. */
5
+ export declare function fmtClock(ms: number, is12h: boolean): string;
6
+ /** The app displays 12-hour time everywhere. */
7
+ export declare function useTimeFormat(): boolean;
8
+ /** Coarse relative time from an epoch-ms timestamp, e.g. "5 months ago", "just now". */
9
+ export declare function fmtRelative(ms: number): string;
10
+ export declare const useSettingBool: (key: string, fallback?: boolean) => boolean;
11
+ export declare const useSettingString: (key: string, fallback?: string) => string;
12
+ export declare const useSettingNumber: (key: string, fallback?: number) => number;
@@ -0,0 +1,80 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ import { monaco } from "../../core/monaco";
3
+ import { type EditorSettings } from "../../core/editorsettings";
4
+ import type { DirtyRange } from "./tree";
5
+ declare function MonacoEditorInner({ path, rel, value, onChange, onSave, gotoLine, gotoCol, gotoNonce, highlight, dirty, settings, onEditor }: {
6
+ path: string;
7
+ rel?: string | null;
8
+ value: string;
9
+ onChange: (v: string) => void;
10
+ onSave?: () => void;
11
+ gotoLine?: number;
12
+ gotoCol?: number;
13
+ gotoNonce?: number;
14
+ highlight?: {
15
+ query: string;
16
+ caseSensitive: boolean;
17
+ isRegex: boolean;
18
+ wholeWord: boolean;
19
+ } | null;
20
+ dirty?: DirtyRange[];
21
+ settings: EditorSettings;
22
+ /** Hands the live editor out, and null on unmount. For a formatting toolbar, which has to
23
+ * dispatch into this instance rather than rewrite the string around it. */
24
+ onEditor?: (e: monaco.editor.IStandaloneCodeEditor | null) => void;
25
+ }): import("react").JSX.Element;
26
+ /**
27
+ * Monaco owns its buffer, so this component re-rendering achieves nothing on its own — yet it was
28
+ * re-rendering on every keystroke, because Editor re-renders per character and passes a new
29
+ * `value` and freshly-defined callbacks each time.
30
+ *
31
+ * The comparator ignores exactly the props that cannot affect what is on screen: every callback
32
+ * (each is read through a ref that is reassigned on render, so identity is already irrelevant) and
33
+ * `value` itself (the editor's text comes from its model, never from this prop after mount).
34
+ * What remains are the props that really do drive an effect.
35
+ */
36
+ export declare const MonacoEditor: import("react").MemoExoticComponent<typeof MonacoEditorInner>;
37
+ export declare function applyLineChanges(original: monaco.editor.ITextModel, modified: monaco.editor.ITextModel, diffs: monaco.editor.ILineChange[]): string;
38
+ export interface HunkAction {
39
+ label: string;
40
+ unstage: boolean;
41
+ run: (change: monaco.editor.ILineChange, models: {
42
+ original: monaco.editor.ITextModel;
43
+ modified: monaco.editor.ITextModel;
44
+ }) => void;
45
+ }
46
+ /** A side of a diff: LEFT the old version, RIGHT the new — GitHub's names, which line comments use. */
47
+ export type DiffSide = "LEFT" | "RIGHT";
48
+ /**
49
+ * Line comments on a diff (a pull request's): a mark in the gutter for each thread, a click on a
50
+ * line number to start one, and a line to bring into view when a thread is picked from the list.
51
+ */
52
+ export interface LineComments {
53
+ marks: {
54
+ line: number;
55
+ side: DiffSide;
56
+ resolved: boolean;
57
+ }[];
58
+ /** `other`: the same line on the other side when this one is unchanged, else null. */
59
+ onPick: (line: number, side: DiffSide, other: number | null) => void;
60
+ /** `n` changes to reveal again, even the same line. */
61
+ reveal?: {
62
+ line: number;
63
+ side: DiffSide;
64
+ n: number;
65
+ };
66
+ }
67
+ export declare function MonacoDiff({ path, head, work, sideBySide, readOnly, rev, onChange, onSave, hunkAction, lineComments }: {
68
+ path: string;
69
+ head: string;
70
+ work: string;
71
+ sideBySide: boolean;
72
+ readOnly: boolean;
73
+ rev: number;
74
+ onChange: (v: string) => void;
75
+ /** Ctrl+S from inside the diff. Without it an editable diff took edits and silently lost them. */
76
+ onSave?: () => void;
77
+ hunkAction?: HunkAction;
78
+ lineComments?: LineComments;
79
+ }): import("react").JSX.Element;
80
+ export {};
@@ -0,0 +1,2 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ export declare const GAP = "\u00A0\u00A0\u00A0\u00A0";
@@ -0,0 +1,13 @@
1
+ // GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
2
+ /** A line change as Monaco's diff reports it: an end of 0 means that side's range is empty. */
3
+ export interface LineChange {
4
+ originalStartLineNumber: number;
5
+ originalEndLineNumber: number;
6
+ modifiedStartLineNumber: number;
7
+ modifiedEndLineNumber: number;
8
+ }
9
+ /**
10
+ * The line on the other side of the diff that `line` on `side` is the same line as, or null when
11
+ * it is inside a change. GitLab needs both numbers to place a comment on an unchanged line.
12
+ */
13
+ export declare function counterpartLine(changes: readonly LineChange[], line: number, side: "LEFT" | "RIGHT"): number | null;