-
Notifications
You must be signed in to change notification settings - Fork 320
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
Monaco integration #88
Comments
@akosyakov in principal yes, however this is quite some work. Besides different names there are semantic differences as well (that is why the names are different at the end). For example in Monaco position informations are one based, whereas in the VS Code API they are zero based. |
It looks like sourcegraph is using the language server protocol with monaco. |
would be awesome if web sockets were used. it might then be easy to make a pure brower-based client without much trouble, i hope? |
@mbana i would prefer that transport should be interchangeable, as actually it is a case with vscode integration. |
OK. The right approach would be to make the converters pluggable into the language client. There is already an interface for this in the corresponding file (e.g. Converter interface type). The converters also expose old legacy functions. When we make this pluggable we should remove the old function and break (e.g. version 3.0). |
@dbaeumer and @akosyakov, so i tried out another approach, which although quite painful requires little code change in modules within LanguageClient:langserver-antha - [Trace - 9:21:35 PM] Received response 'initialize - (0)' in 16ms. Request failed: invalid root path "": must be file:/// URI (0).
(index):137 LanguageClient:langserver-antha - [Error - 9:21:35 PM] Server initialization failed.
(index):137 LanguageClient:langserver-antha - Error: invalid root path "": must be file:/// URI
at new ResponseError (http://127.0.0.1:8080/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:371:32)
at handleResponse (http://127.0.0.1:8080/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:988:48)
at WebSocketMessageReader.callback (http://127.0.0.1:8080/node_modules/vscode-languageclient/node_modules/vscode-jsonrpc/lib/main.js:1168:17)
at WebSocketMessageReader.onMessage (http://127.0.0.1:8080/release/dev/goMode.js:524:18)
at WebSocket.ws.onmessage (http://127.0.0.1:8080/release/dev/goMode.js:512:27)
goWorker.js:18createData: Object
:8080/release/dev/goWorker.js:18 createData:
|
@dbaeumer @akosyakov, ta, |
@dbaeumer I don't think that having converters is enough, it would be nice if |
@akosyakov makes a good point.
i believe ref: https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/codeConverter.ts |
I agree to make this right we need to take the libraries apart in an VS Code independent part and a part the depends on VS Code. In addition we would need to factor out node dependencies which will hurt in the browser (Monaco) as well. At the end of the day I am not sure if we should have this in one repository or only make json-rpc node independent and have a separate repository |
I've been prototyping this approach in the fork: https://github.com/TypeFox/vscode-languageserver-node/tree/ak/vscode_independent_client There are 2 ts modules introducing extensions:
then there are vscode implementation of services (not complete) and node implementation of connection, in our project we have also monaco implementation of services and web socket implementation of connection regarding of maintenance:
interesting side effects:
and there seem to be a bug:
|
The API also aligned as some subtile differences. One major one is that the Monaco API is 1 based when taking to the editor and the VS Code is zero based. In addition that are difference in the document selector. So besides abstracting the client all converters need to consider the subtile differences. This is why I think it might be better to have a monaco-languageserver projects which might share some code with the vscode-languageserver project but not everything is mangled into one project. Thanks for the bug report. I added: for (let handler of this._registeredHandlers.values()) {
handler.dispose();
}
this._registeredHandlers.clear(); |
We published monaco-languageclient, that is based on our fork of vscode-languageserver-node/client changed to be vscode and node independent as described above and published as vscode-base-languageclient. Ideally we would like to avoid having another module for Regarding subtle differences:
|
@akosyakov I will look into providing the BaseLanguageClient this month so that you can get rid of the fork. Thanks for providing the monaco-languageclient |
Objection to close this issue. |
We could keep it for discussions around |
I pushed a commit to master that introduces the BaseLanguageClient. I will close this one. We should open specific issues if we encounter problems with the BaseLanguageClient. |
I want to connect monaco editor with a language server by means of this project.
I've managed to make use of
jsonrpc
module to create a client connection and hoped to reuse code and protocol converters, but it seems that types expected by vscode and monaco are not compatible, e.g. monaco.IRange vs vscode.Range.I'm aware that monaco is assembled from vscode. Would it be possible to eliminate the difference?
The text was updated successfully, but these errors were encountered: