Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: textDocument/completion hangs starting in version 1.43 #25610

Closed
aaronhuggins opened this issue Sep 13, 2024 · 2 comments
Closed

LSP: textDocument/completion hangs starting in version 1.43 #25610

aaronhuggins opened this issue Sep 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working correctly lsp related to the language server

Comments

@aaronhuggins
Copy link

Version: Deno 1.43, 1.44, 1.45, 1.46

Prior to version 1.43, the following code worked as expected and provided a completion response. Starting at 1.43, the response for a textDocument/completion just hangs, holding up the parent process.

This code snippet is for reproduction purposes.

import * as rpc from "npm:[email protected]/node.js";
import { Readable, Writable } from "node:stream";

const uri = "file:///stub.ts";
const text = "console.";
const languageId = "typescript";
const command = new Deno.Command(Deno.execPath(), {
    args: ["lsp"],
    stderr: "null",
    stdin: "piped",
    stdout: "piped",
});
const process = command.spawn();
const connection = rpc.createMessageConnection(
    new rpc.StreamMessageReader(Readable.fromWeb(process.stdout as any)),
    new rpc.StreamMessageWriter(Writable.fromWeb(process.stdin)),
);

connection.listen();

const res = await connection.sendRequest("initialize", {
    processId: Deno.pid,
    capabilities: {},
    rootUri: null,
    clientInfo: {
        name: "example",
        version: "0.10.11",
    },
    locale: "en",
    initializationOptions: {
        enable: true,
    },
});

console.log(res);

await connection.sendNotification("textDocument/didOpen", {
    textDocument: {
        uri,
        text,
        version: 1,
        languageId,
    },
});

const res2 = await connection.sendRequest("textDocument/completion", {
    textDocument: { uri },
    position: { line: 1, character: 8 },
    context: { triggerKind: 1 },
});

console.log(res2);

connection.end();
process.kill();
@marvinhagemeister marvinhagemeister added lsp related to the language server bug Something isn't working correctly labels Sep 13, 2024
@nayeemrmn
Copy link
Collaborator

You have to send the initialized notification after receiving the response to initialize. This unblocks the rest of the language server. We do this because the proper pull-based configuration (though it's not really applicable to your client) cannot be fetched until the initialized handler and we want to make sure it's incorporated before processing other requests. See microsoft/language-server-protocol#567 (comment).

Working as intended.

@nayeemrmn nayeemrmn closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2024
@aaronhuggins
Copy link
Author

aaronhuggins commented Sep 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly lsp related to the language server
Projects
None yet
Development

No branches or pull requests

3 participants