Open FoxDaxian opened 2 years ago
Whether to support worker like this:
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker';
import vueWorker from 'vls/vue.worker'; <--- here
self.MonacoEnvironment = {
getWorker(_: any, label: string) {
console.log(label, '==label');
if (label === 'json') {
return new jsonWorker();
}
if (label === 'vue') { <---- and here
return new vueWorker();
}
if (label === 'html' || label === 'handlebars' || label === 'razor') {
return new htmlWorker();
}
return new editorWorker();
}
};
what errors are you seeing? Vetur has several ways to log and debug attach to lsp server. If the initialization process fails, either monaco or vetur will tell you about it afaik.
@phil294 thank you for reply
There is no error when run server. looks like as below:
And code like this:
connection.onInitialize(async (params) => {
await _vls.init(params);
console.log("Vetur initialized =====");
return {
capabilities: _vls.capabilities,
};
});
@phil294 Sorry to disturb~ this is the lastest process: discussions
I found textDocument/didOpen event get wrong params like:
{
jsonrpc: '2.0',
method: 'textDocument/didOpen',
params: {
textDocument: {
uri: 'inmemory://model/1', <----- I think this is incorrect uri
languageId: 'vue',
version: 1,
text: ''
}
}
}
I'm not pass default value for monaco-editor, so it is no content by default. and the uri of textDocument looks like the source code stored in the memory?
how to resolve this problem? thanks~
anybody? help~
@HerringtonDarkholme @yoyo930021 sorry to disturb~ 🙏🏻
@FoxDaxian
i used https://github.com/wylieconlon/jsonrpc-ws-proxy and, with a couple of configuration bits inside of the client.ts, had it up and running (syntax, suggestions, etc). Only syntax highlighting to go.
the workspaceFolder inside of the clientOptions (in client.js), i set it to the folder where the server's files live.
This article was invaluable: https://medium.com/dscddu/language-server-protocol-adding-support-for-multiple-language-servers-to-monaco-editor-a3c35e42a98d
i can't pretend to know exactly how it's working as yet, because documentation on some of these things is very slim and right now it's just about getting it working - the end target is Volar, but that doesn't seem to integrate in the same way :-p
Good luck.
@redbullmarky thanks for reply very much. 😊 and i'll try this way what you mention. and wish me luck. 😭
The vetur can't work well in environments other than nodejs.
Vetur is based on typescript language service. The typescript language service can't work well for this.
Vetur: Restart VLS
Info
Problem
I changed json to vue of node demo of monaco-languageclient as below:
But it is not work after those change.
So how to connect monaco-editor with vls?
Any answer would be greatly appreciated. thank you!
Reproducible Case
As above.