@dsh-cc/pi-tui 0.5.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/LICENSE +21 -0
- package/PORTING.md +18 -0
- package/README.md +7 -0
- package/lib/alt-screen-search.d.ts +26 -0
- package/lib/alt-screen-search.d.ts.map +1 -0
- package/lib/alt-screen-search.js +122 -0
- package/lib/alt-screen-search.js.map +1 -0
- package/lib/autocomplete.d.ts +56 -0
- package/lib/autocomplete.d.ts.map +1 -0
- package/lib/autocomplete.js +632 -0
- package/lib/autocomplete.js.map +1 -0
- package/lib/components/alt-screen-flash.d.ts +13 -0
- package/lib/components/alt-screen-flash.d.ts.map +1 -0
- package/lib/components/alt-screen-flash.js +37 -0
- package/lib/components/alt-screen-flash.js.map +1 -0
- package/lib/components/box.d.ts +22 -0
- package/lib/components/box.d.ts.map +1 -0
- package/lib/components/box.js +104 -0
- package/lib/components/box.js.map +1 -0
- package/lib/components/cancellable-loader.d.ts +22 -0
- package/lib/components/cancellable-loader.d.ts.map +1 -0
- package/lib/components/cancellable-loader.js +35 -0
- package/lib/components/cancellable-loader.js.map +1 -0
- package/lib/components/editor.d.ts +255 -0
- package/lib/components/editor.d.ts.map +1 -0
- package/lib/components/editor.js +1961 -0
- package/lib/components/editor.js.map +1 -0
- package/lib/components/h-stack.d.ts +7 -0
- package/lib/components/h-stack.d.ts.map +1 -0
- package/lib/components/h-stack.js +43 -0
- package/lib/components/h-stack.js.map +1 -0
- package/lib/components/image.d.ts +28 -0
- package/lib/components/image.d.ts.map +1 -0
- package/lib/components/image.js +90 -0
- package/lib/components/image.js.map +1 -0
- package/lib/components/input.d.ts +37 -0
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +378 -0
- package/lib/components/input.js.map +1 -0
- package/lib/components/loader.d.ts +31 -0
- package/lib/components/loader.d.ts.map +1 -0
- package/lib/components/loader.js +69 -0
- package/lib/components/loader.js.map +1 -0
- package/lib/components/markdown.d.ts +103 -0
- package/lib/components/markdown.d.ts.map +1 -0
- package/lib/components/markdown.js +811 -0
- package/lib/components/markdown.js.map +1 -0
- package/lib/components/scroll-view.d.ts +56 -0
- package/lib/components/scroll-view.d.ts.map +1 -0
- package/lib/components/scroll-view.js +189 -0
- package/lib/components/scroll-view.js.map +1 -0
- package/lib/components/select-list.d.ts +50 -0
- package/lib/components/select-list.d.ts.map +1 -0
- package/lib/components/select-list.js +159 -0
- package/lib/components/select-list.js.map +1 -0
- package/lib/components/settings-list.d.ts +56 -0
- package/lib/components/settings-list.d.ts.map +1 -0
- package/lib/components/settings-list.js +202 -0
- package/lib/components/settings-list.js.map +1 -0
- package/lib/components/spacer.d.ts +12 -0
- package/lib/components/spacer.d.ts.map +1 -0
- package/lib/components/spacer.js +23 -0
- package/lib/components/spacer.js.map +1 -0
- package/lib/components/stack.d.ts +32 -0
- package/lib/components/stack.d.ts.map +1 -0
- package/lib/components/stack.js +111 -0
- package/lib/components/stack.js.map +1 -0
- package/lib/components/text.d.ts +19 -0
- package/lib/components/text.d.ts.map +1 -0
- package/lib/components/text.js +90 -0
- package/lib/components/text.js.map +1 -0
- package/lib/components/truncated-text.d.ts +13 -0
- package/lib/components/truncated-text.d.ts.map +1 -0
- package/lib/components/truncated-text.js +51 -0
- package/lib/components/truncated-text.js.map +1 -0
- package/lib/components/v-stack.d.ts +8 -0
- package/lib/components/v-stack.d.ts.map +1 -0
- package/lib/components/v-stack.js +26 -0
- package/lib/components/v-stack.js.map +1 -0
- package/lib/editor-component.d.ts +39 -0
- package/lib/editor-component.d.ts.map +1 -0
- package/lib/editor-component.js +2 -0
- package/lib/editor-component.js.map +1 -0
- package/lib/fuzzy.d.ts +16 -0
- package/lib/fuzzy.d.ts.map +1 -0
- package/lib/fuzzy.js +110 -0
- package/lib/fuzzy.js.map +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +42 -0
- package/lib/index.js.map +1 -0
- package/lib/keybindings.d.ts +273 -0
- package/lib/keybindings.d.ts.map +1 -0
- package/lib/keybindings.js +233 -0
- package/lib/keybindings.js.map +1 -0
- package/lib/keys.d.ts +184 -0
- package/lib/keys.d.ts.map +1 -0
- package/lib/keys.js +1174 -0
- package/lib/keys.js.map +1 -0
- package/lib/kill-ring.d.ts +28 -0
- package/lib/kill-ring.d.ts.map +1 -0
- package/lib/kill-ring.js +44 -0
- package/lib/kill-ring.js.map +1 -0
- package/lib/latex.d.ts +10 -0
- package/lib/latex.d.ts.map +1 -0
- package/lib/latex.js +1271 -0
- package/lib/latex.js.map +1 -0
- package/lib/layout-node.d.ts +40 -0
- package/lib/layout-node.d.ts.map +1 -0
- package/lib/layout-node.js +6 -0
- package/lib/layout-node.js.map +1 -0
- package/lib/layout.d.ts +40 -0
- package/lib/layout.d.ts.map +1 -0
- package/lib/layout.js +321 -0
- package/lib/layout.js.map +1 -0
- package/lib/native-modifiers.d.ts +3 -0
- package/lib/native-modifiers.d.ts.map +1 -0
- package/lib/native-modifiers.js +54 -0
- package/lib/native-modifiers.js.map +1 -0
- package/lib/native-module-path.d.ts +7 -0
- package/lib/native-module-path.d.ts.map +1 -0
- package/lib/native-module-path.js +19 -0
- package/lib/native-module-path.js.map +1 -0
- package/lib/stdin-buffer.d.ts +56 -0
- package/lib/stdin-buffer.d.ts.map +1 -0
- package/lib/stdin-buffer.js +366 -0
- package/lib/stdin-buffer.js.map +1 -0
- package/lib/terminal-colors.d.ts +10 -0
- package/lib/terminal-colors.d.ts.map +1 -0
- package/lib/terminal-colors.js +59 -0
- package/lib/terminal-colors.js.map +1 -0
- package/lib/terminal-image.d.ts +116 -0
- package/lib/terminal-image.d.ts.map +1 -0
- package/lib/terminal-image.js +518 -0
- package/lib/terminal-image.js.map +1 -0
- package/lib/terminal.d.ts +117 -0
- package/lib/terminal.d.ts.map +1 -0
- package/lib/terminal.js +447 -0
- package/lib/terminal.js.map +1 -0
- package/lib/tui-alt-screen.d.ts +118 -0
- package/lib/tui-alt-screen.d.ts.map +1 -0
- package/lib/tui-alt-screen.js +1148 -0
- package/lib/tui-alt-screen.js.map +1 -0
- package/lib/tui-main-screen.d.ts +39 -0
- package/lib/tui-main-screen.d.ts.map +1 -0
- package/lib/tui-main-screen.js +533 -0
- package/lib/tui-main-screen.js.map +1 -0
- package/lib/tui.d.ts +308 -0
- package/lib/tui.d.ts.map +1 -0
- package/lib/tui.js +941 -0
- package/lib/tui.js.map +1 -0
- package/lib/undo-stack.d.ts +17 -0
- package/lib/undo-stack.d.ts.map +1 -0
- package/lib/undo-stack.js +25 -0
- package/lib/undo-stack.js.map +1 -0
- package/lib/utils.d.ts +96 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +1191 -0
- package/lib/utils.js.map +1 -0
- package/lib/word-navigation.d.ts +25 -0
- package/lib/word-navigation.d.ts.map +1 -0
- package/lib/word-navigation.js +96 -0
- package/lib/word-navigation.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PORTING.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PORTING — @dsh-cc/pi-tui
|
|
2
|
+
|
|
3
|
+
Vendored copy of pi-tui from canonical upstream.
|
|
4
|
+
|
|
5
|
+
- **Upstream**: https://github.com/earendil-works/pi → `packages/tui`
|
|
6
|
+
- **Upstream SHA at vendor time**: `8fa7eebd235355522c8104166b4f1f959b4e2f10` (reproducible: these are canonical bytes of that commit)
|
|
7
|
+
- **Vendor date**: 2026-08-26
|
|
8
|
+
- **npm cross-check**: `@earendil-works/pi-tui@0.84.3` (published dist of the same line)
|
|
9
|
+
- **Excluded**: `native/` (darwin CoreGraphics helper; the JS path stands alone — on macOS some modifier disambiguation falls back), `test/`, upstream build (`tsgo`, `tsconfig.build.json`, `scripts.*`) — this package builds via the repo's root `tsc -b` like every sibling
|
|
10
|
+
- **Re-vendor protocol**: update SHA + date above; every local edit must append a numbered entry below before commit
|
|
11
|
+
|
|
12
|
+
## Local divergences
|
|
13
|
+
|
|
14
|
+
Source is byte-identical to the recorded SHA. Building it under this repo's `tsconfig.base.json` required looser pedantic flags than upstream's own build (`strict: true` only):
|
|
15
|
+
|
|
16
|
+
- **D1 (build config)**: `packages/ui/pi-tui/tsconfig.json` sets `exactOptionalPropertyTypes: false`, `noUncheckedIndexedAccess: false`, `noImplicitOverride: false`, `noUnusedLocals: false`. Upstream builds with plain `strict: true` (tsgo); the four repo pedantic flags produce only internal type-level errors, none behavioral. Source stays pristine; only the vendored package's own tsconfig differs.
|
|
17
|
+
- **D2 (packaging)**: published under the `@dsh-cc/pi-tui` name because the TUI surface ships it as a `workspace:^` dependency; MIT attribution travels via LICENSE and this file. Upstream identity (`@earendil-works/pi-tui`) is the provenance record above, not our package name.
|
|
18
|
+
- **D3 (check:size exemption)**: `scripts/check-file-size.mjs` skips this subtree (`VENDOR_EXEMPT`, kept in sync with `PKG` in `scripts/check-vendor-purity.mjs`). Re-vendoring replaces `src/` wholesale, so a local file split would be destroyed on every upstream SHA bump. First-party sources are hard-capped at 500 lines; this package is not.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @dsh-cc/pi-tui
|
|
2
|
+
|
|
3
|
+
Vendored upstream [pi-tui](https://github.com/earendil-works/pi) (`packages/tui`) renderer for the dsh-cc-plugins TUI.
|
|
4
|
+
|
|
5
|
+
Vendored (not npm-depended) because the surface will need deliberate divergences (markdown wrapping, composer triggers, theme seams) and the repo's pattern is vendor-on-invasive-delta. Source of truth for provenance and local edits: [PORTING.md](./PORTING.md). License: MIT (see LICENSE).
|
|
6
|
+
|
|
7
|
+
**Rule**: this package must not import `@deepseek-ai/*`, `@dsh-cc/*`, or anything outside its own tree beyond its two declared deps and node builtins. Enforced: `pnpm run check:vendor-purity`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Component, Focusable } from "./tui.ts";
|
|
2
|
+
export interface AltScreenSearchSegment {
|
|
3
|
+
row: number;
|
|
4
|
+
startCol: number;
|
|
5
|
+
endCol: number;
|
|
6
|
+
}
|
|
7
|
+
export interface AltScreenSearchMatch {
|
|
8
|
+
segments: AltScreenSearchSegment[];
|
|
9
|
+
}
|
|
10
|
+
export declare function findAltScreenSearchMatches(lines: readonly string[], query: string): AltScreenSearchMatch[];
|
|
11
|
+
export declare function getAltScreenSearchMatchKey(match: AltScreenSearchMatch): string;
|
|
12
|
+
export declare class AltScreenSearchComponent implements Component, Focusable {
|
|
13
|
+
private readonly input;
|
|
14
|
+
private readonly onQueryChange;
|
|
15
|
+
private resultCount;
|
|
16
|
+
private resultIndex;
|
|
17
|
+
private _focused;
|
|
18
|
+
constructor(onQueryChange: (query: string) => void);
|
|
19
|
+
get focused(): boolean;
|
|
20
|
+
set focused(value: boolean);
|
|
21
|
+
setResult(index: number, count: number): void;
|
|
22
|
+
handleInput(data: string): void;
|
|
23
|
+
invalidate(): void;
|
|
24
|
+
render(width: number): string[];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=alt-screen-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alt-screen-search.d.ts","sourceRoot":"","sources":["../src/alt-screen-search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAWrD,MAAM,WAAW,sBAAsB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAkDD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,oBAAoB,EAAE,CA0B1G;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAI9E;AAED,qBAAa,wBAAyB,YAAW,SAAS,EAAE,SAAS;IACpE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0B;IACxD,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,QAAQ,CAAS;gBAEb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;IAIlD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO/B,UAAU,IAAI,IAAI;IAIlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CAgB/B"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Input } from "./components/input.js";
|
|
2
|
+
import { getGraphemeSegmenter, stripTerminalSequences, truncateToWidth, visibleWidth } from "./utils.js";
|
|
3
|
+
const segmenter = getGraphemeSegmenter();
|
|
4
|
+
function appendMappedText(text, span, corpus) {
|
|
5
|
+
corpus.text += text;
|
|
6
|
+
for (let index = 0; index < text.length; index++)
|
|
7
|
+
corpus.source.push(span);
|
|
8
|
+
}
|
|
9
|
+
function buildSearchCorpus(lines) {
|
|
10
|
+
const corpus = { text: "", source: [] };
|
|
11
|
+
let pendingSeparator = false;
|
|
12
|
+
for (let row = 0; row < lines.length; row++) {
|
|
13
|
+
const line = stripTerminalSequences(lines[row] ?? "");
|
|
14
|
+
let column = 0;
|
|
15
|
+
for (const grapheme of segmenter.segment(line)) {
|
|
16
|
+
const text = grapheme.segment;
|
|
17
|
+
const width = visibleWidth(text);
|
|
18
|
+
if (/^\s+$/u.test(text)) {
|
|
19
|
+
if (corpus.text.length > 0)
|
|
20
|
+
pendingSeparator = true;
|
|
21
|
+
column += width;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (pendingSeparator) {
|
|
25
|
+
appendMappedText(" ", undefined, corpus);
|
|
26
|
+
pendingSeparator = false;
|
|
27
|
+
}
|
|
28
|
+
appendMappedText(text, { row, startCol: column, endCol: column + width }, corpus);
|
|
29
|
+
column += width;
|
|
30
|
+
}
|
|
31
|
+
if (corpus.text.length > 0)
|
|
32
|
+
pendingSeparator = true;
|
|
33
|
+
}
|
|
34
|
+
return corpus;
|
|
35
|
+
}
|
|
36
|
+
function normalizeQuery(query) {
|
|
37
|
+
return query.replace(/\s+/gu, " ").trim();
|
|
38
|
+
}
|
|
39
|
+
function escapeRegExp(text) {
|
|
40
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
41
|
+
}
|
|
42
|
+
export function findAltScreenSearchMatches(lines, query) {
|
|
43
|
+
const normalizedQuery = normalizeQuery(query);
|
|
44
|
+
if (!normalizedQuery)
|
|
45
|
+
return [];
|
|
46
|
+
const corpus = buildSearchCorpus(lines);
|
|
47
|
+
const expression = new RegExp(escapeRegExp(normalizedQuery), "giu");
|
|
48
|
+
const matches = [];
|
|
49
|
+
for (const match of corpus.text.matchAll(expression)) {
|
|
50
|
+
const start = match.index;
|
|
51
|
+
const end = start + match[0].length;
|
|
52
|
+
const segments = [];
|
|
53
|
+
for (let index = start; index < end; index++) {
|
|
54
|
+
const span = corpus.source[index];
|
|
55
|
+
if (!span)
|
|
56
|
+
continue;
|
|
57
|
+
const previous = segments[segments.length - 1];
|
|
58
|
+
if (previous && previous.row === span.row && span.startCol <= previous.endCol) {
|
|
59
|
+
previous.endCol = Math.max(previous.endCol, span.endCol);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
segments.push({ ...span });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (segments.length > 0)
|
|
66
|
+
matches.push({ segments });
|
|
67
|
+
}
|
|
68
|
+
return matches;
|
|
69
|
+
}
|
|
70
|
+
export function getAltScreenSearchMatchKey(match) {
|
|
71
|
+
const first = match.segments[0];
|
|
72
|
+
const last = match.segments[match.segments.length - 1];
|
|
73
|
+
return first && last ? `${first.row}:${first.startCol}:${last.row}:${last.endCol}` : "";
|
|
74
|
+
}
|
|
75
|
+
export class AltScreenSearchComponent {
|
|
76
|
+
input = new Input();
|
|
77
|
+
onQueryChange;
|
|
78
|
+
resultCount = 0;
|
|
79
|
+
resultIndex = -1;
|
|
80
|
+
_focused = false;
|
|
81
|
+
constructor(onQueryChange) {
|
|
82
|
+
this.onQueryChange = onQueryChange;
|
|
83
|
+
}
|
|
84
|
+
get focused() {
|
|
85
|
+
return this._focused;
|
|
86
|
+
}
|
|
87
|
+
set focused(value) {
|
|
88
|
+
this._focused = value;
|
|
89
|
+
this.input.focused = value;
|
|
90
|
+
}
|
|
91
|
+
setResult(index, count) {
|
|
92
|
+
this.resultIndex = index;
|
|
93
|
+
this.resultCount = count;
|
|
94
|
+
}
|
|
95
|
+
handleInput(data) {
|
|
96
|
+
const previous = this.input.getValue();
|
|
97
|
+
this.input.handleInput(data);
|
|
98
|
+
const query = this.input.getValue();
|
|
99
|
+
if (query !== previous)
|
|
100
|
+
this.onQueryChange(query);
|
|
101
|
+
}
|
|
102
|
+
invalidate() {
|
|
103
|
+
this.input.invalidate();
|
|
104
|
+
}
|
|
105
|
+
render(width) {
|
|
106
|
+
const safeWidth = Math.max(1, width);
|
|
107
|
+
const label = " Find transcript";
|
|
108
|
+
const query = this.input.getValue();
|
|
109
|
+
const status = !query
|
|
110
|
+
? ""
|
|
111
|
+
: this.resultCount === 0
|
|
112
|
+
? "No matches "
|
|
113
|
+
: `${this.resultIndex + 1}/${this.resultCount} `;
|
|
114
|
+
const labelWidth = visibleWidth(label);
|
|
115
|
+
const statusWidth = visibleWidth(status);
|
|
116
|
+
const gap = " ".repeat(Math.max(1, safeWidth - labelWidth - statusWidth));
|
|
117
|
+
const title = truncateToWidth(`${label}${gap}${status}`, safeWidth, "");
|
|
118
|
+
const padding = " ".repeat(Math.max(0, safeWidth - visibleWidth(title)));
|
|
119
|
+
return [`\x1b[7m${title}${padding}\x1b[27m`, ...this.input.render(safeWidth)];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=alt-screen-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alt-screen-search.js","sourceRoot":"","sources":["../src/alt-screen-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,eAAe,EAAE,YA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,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC;QACnD,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC;QAC1E,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,KAAK,GAAG,GAAG,GAAG,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QACxE,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACzE,OAAO,CAAC,UAAU,KAAK,GAAG,OAAO,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/E,CAAC;CACD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface AutocompleteItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
type Awaitable<T> = T | Promise<T>;
|
|
7
|
+
export interface SlashCommand {
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
argumentHint?: string;
|
|
11
|
+
getArgumentCompletions?(argumentPrefix: string): Awaitable<AutocompleteItem[] | null>;
|
|
12
|
+
}
|
|
13
|
+
export interface AutocompleteSuggestions {
|
|
14
|
+
items: AutocompleteItem[];
|
|
15
|
+
prefix: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AutocompleteProvider {
|
|
18
|
+
/** Characters that should naturally trigger this provider at token boundaries. */
|
|
19
|
+
triggerCharacters?: string[];
|
|
20
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number, options: {
|
|
21
|
+
signal: AbortSignal;
|
|
22
|
+
force?: boolean;
|
|
23
|
+
}): Promise<AutocompleteSuggestions | null>;
|
|
24
|
+
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
25
|
+
lines: string[];
|
|
26
|
+
cursorLine: number;
|
|
27
|
+
cursorCol: number;
|
|
28
|
+
};
|
|
29
|
+
shouldTriggerFileCompletion?(lines: string[], cursorLine: number, cursorCol: number): boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
32
|
+
private commands;
|
|
33
|
+
private basePath;
|
|
34
|
+
private fdPath;
|
|
35
|
+
constructor(commands: (SlashCommand | AutocompleteItem)[] | undefined, basePath: string, fdPath?: string | null);
|
|
36
|
+
getSuggestions(lines: string[], cursorLine: number, cursorCol: number, options: {
|
|
37
|
+
signal: AbortSignal;
|
|
38
|
+
force?: boolean;
|
|
39
|
+
}): Promise<AutocompleteSuggestions | null>;
|
|
40
|
+
applyCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
|
|
41
|
+
lines: string[];
|
|
42
|
+
cursorLine: number;
|
|
43
|
+
cursorCol: number;
|
|
44
|
+
};
|
|
45
|
+
private extractAtPrefix;
|
|
46
|
+
private extractPathPrefix;
|
|
47
|
+
private expandHomePath;
|
|
48
|
+
private resolveScopedFuzzyQuery;
|
|
49
|
+
private scopedPathForDisplay;
|
|
50
|
+
private getFileSuggestions;
|
|
51
|
+
private scoreEntry;
|
|
52
|
+
private getFuzzyFileSuggestions;
|
|
53
|
+
shouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=autocomplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","source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