fix: disable hash console completions
This commit is contained in:
parent
ad66650369
commit
20654f9c40
|
|
@ -22,7 +22,7 @@ function assertEquals<T>(actual: T, expected: T): void {
|
|||
}
|
||||
}
|
||||
|
||||
Deno.test("completionTokenAt detects TUI-style sigils before the cursor", () => {
|
||||
Deno.test("completionTokenAt detects command and file sigils before the cursor", () => {
|
||||
assertEquals(completionTokenAt("open @src/ma", "open @src/ma".length), {
|
||||
sigil: "@",
|
||||
kind: "file",
|
||||
|
|
@ -32,6 +32,7 @@ Deno.test("completionTokenAt detects TUI-style sigils before the cursor", () =>
|
|||
});
|
||||
assertEquals(completionTokenAt(":comp", 5)?.kind, "command");
|
||||
assertEquals(completionTokenAt("run /work", 9), null);
|
||||
assertEquals(completionTokenAt("ask #plain", "ask #plain".length), null);
|
||||
});
|
||||
|
||||
Deno.test("applyCompletion replaces the active token and advances the cursor", () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export type ComposerCompletionKind = "command" | "file";
|
||||
|
||||
export type ComposerCompletionToken = {
|
||||
sigil: ":" | "@" | "#";
|
||||
sigil: ":" | "@";
|
||||
kind: ComposerCompletionKind;
|
||||
start: number;
|
||||
end: number;
|
||||
|
|
@ -35,7 +35,7 @@ export function completionTokenAt(
|
|||
): ComposerCompletionToken | null {
|
||||
const boundedCursor = Math.max(0, Math.min(cursor, value.length));
|
||||
const before = value.slice(0, boundedCursor);
|
||||
const match = /(^|\s)([:@#])([^\s]*)$/.exec(before);
|
||||
const match = /(^|\s)([:@])([^\s]*)$/.exec(before);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -83,8 +83,6 @@ function completionKindForSigil(
|
|||
switch (sigil) {
|
||||
case ":":
|
||||
return "command";
|
||||
default:
|
||||
return "file";
|
||||
case "@":
|
||||
return "file";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user