Replies: 2 comments
-
I don't know. Please refer to codemirror documentation on how to plug in LSP servers. This server already documents the command line arguments it supports and otherwise it uses standardized LSP protocol. |
Beta Was this translation helpful? Give feedback.
-
You can use vscode-jsonrpc to communicate with the language server in nodejs example code import * as cp from 'child_process';
import * as rpc from 'vscode-jsonrpc/node';
const server = cp.spawn('typescript-language-server', ['--stdio']);
const reader = new rpc.StreamMessageReader(server.stdout);
const writer = new rpc.StreamMessageWriter(server.stdin);
const connection = rpc.createMessageConnection(reader, writer);
connection.listen();
const textDocument = {
uri: 'file:///path/to/your/files/index.ts',
languageId: 'typescript',
text: `
console.log("Hello World")
`
};
(async() => {
await connection.sendRequest('initialize', {
rootUri: 'file:///path/to/your/rootDir',
capabilities: {},
processId: process.pid,
}).then((e) => {
// console.log("i",e)
});
await connection.sendNotification('textDocument/didOpen', {
textDocument: textDocument
});
})() You can read - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/ for other requests as for |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Would appreciate if there is a guide on how to spin up a language server and then invoke it using a Code editor like codemirror?
Beta Was this translation helpful? Give feedback.
All reactions