Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions tests/integration/lsp-autocomplete-trigger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe("lsp autocomplete trigger characters", () => {

// Move to line 2 and type 'consol' — should trigger completion
tui.press("ctrl+g");
tui.waitStable();
tui.waitStable(1000);
tui.type("2");
tui.press("enter");
tui.waitStable();
Expand Down Expand Up @@ -110,26 +110,29 @@ describe("lsp autocomplete trigger characters", () => {
cpSync(LSP_DIR, dir, { recursive: true });

const testFile = resolve(dir, "sighelp.js");
writeFileSync(testFile, "// sig\nconsole.log\n", "utf8");
writeFileSync(testFile, "console.log\n", "utf8");
const configFile = resolve(LSP_DIR, "settings.json");

tui.start("--config", configFile, testFile);
tui.waitFor("console.log");
waitForLogAfter("lsp initialized", 0);
tui.waitStable(2000);

// Move to end of line 2 (after "console.log")
tui.press("ctrl+g");
tui.waitStable();
tui.type("2");
tui.press("enter");
tui.waitStable();
// Cursor starts on line 1 — move to end of "console.log"
tui.press("end");
tui.waitStable();

const mark = logSize();

// Type '(' — should trigger signature help
tui.type("(");
const log = waitForLogAfter("lsp signature help response.*label=", mark, 20000);
// Type '(' — should trigger signature help.
// Retry if the LSP server isn't ready yet (returns null).
let log = "";
for (let attempt = 0; attempt < 3; attempt++) {
const mark = logSize();
tui.type("(");
log = waitForLogAfter("lsp signature help response.*label=", mark, 5000);
if (/lsp signature help response.*label=/.test(log)) break;
tui.press("backspace");
tui.waitStable(1000);
}
expect(log).toMatch(/lsp signature help response.*label=/);

tui.press("escape");
Expand All @@ -152,7 +155,7 @@ describe("lsp autocomplete trigger characters", () => {
waitForLogAfter("lsp initialized", 0);

tui.press("ctrl+g");
tui.waitStable();
tui.waitStable(1000);
tui.type("2");
tui.press("enter");
tui.waitStable();
Expand Down
Loading