I'm writing a vscode extension that should connect to tsserver in order to provide language support for typescript/javascript.
Here is how i'm doing it (in extension.ts, inside activate):
const serverModule = path.resolve(
__dirname,
"..",
"node_modules",
"typescript",
"lib",
"tsserver.js"
);
const debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] };
const serverOptions: ServerOptions = {
run: { module: serverModule, transport: TransportKind.ipc },
debug: {
module: serverModule,
transport: TransportKind.ipc,
options: debugOptions,
},
};
const clientOptions = {
documentSelector: [
{
scheme: "file",
language: "typescript",
},
],
};
client = new LanguageClient(
"server-id",
"server-name",
serverOptions,
clientOptions
);
context.subscriptions.push(client.start());
But when I call client.onReady().then(() => client.sendRequest(...)); the request is not sent. I'm almost sure the problem is that the initialization phase is unsuccessful so the onReady() method is blocking me. How do I get it to work ?
tsserver does not use the language server protocol, it has its own json based protocol. You cannot connect to it using the language server protocol apis