-
Notifications
You must be signed in to change notification settings - Fork 48
How do I activate a language server? #10
Comments
Well, I looked a bit into your code and from what I understood, vscode will call activate() on the client when it needs to start the server, as you said. What happens in my plugin is that the commands to start the server are run as soon as you open an editor with a recognized extension. In short, if you can make it work like https://github.com/rcjsuen/dockerfile-language-server-nodejs for example, you just have to install the server, then in your settings, write something like this : If you can't start your server from the command line however, then I don't really know how to help (or I need more infos). |
Okay, the server started log indicates that the process has been started, but not that it is communicating with the client. It's the message "Got initializeResult for ..." that indicates that a connection has been made. If you look at the bottom of the IntelliJ window, you should have an icon for the server, and I imagine it stays yellow (which means starting). The thing is, I'm not very knowledgeable in JavaScript, but I imagine you have to launch your js file with something (and not simply "execute" it). For example, the docker-langserver file (generated by npm I think) that I use to start the docker server uses node to start the server : and the server.js file is simply the "js-translated" equivalent (that npm made when installing I guess) of the server.ts file that you can see at https://github.com/rcjsuen/dockerfile-language-server-nodejs/blob/master/src/server.ts Now, if you want to easily (except the setup) debug using IntelliJ, you can clone/download the intellij-lsp subfolder, create a new IntelliJ plugin project with the root at intellij-lsp, add a new IntelliJ Platform SDK (by going into Project Structure/SDKs) pointing at the IntelliJ installation folder, add a Scala (2.12.4) SDK (by going into Project Structure/Global Libraries), add the required libraries (by going into project structure/libraries and seeing which libraries are needed by looking into the build.gradle file: it's lsp4j, coursier and flexmark ; I guess you could also synchronize using Gradle), and finally launch the plugin and if everything was done correctly a sandbox should start. Now you have easy access to the log in the main IntelliJ window, you can set breakpoints in the code, etc. Sadly, it doesn't seem like you can access a plugin code otherwise, so you can't really debug it if you don't do that I guess... |
I tried doing that (using bin generated by npm) but did not see any difference. The server.ts file being run is similar to the one in the dockerfile-language-server repo. Also, what message in the log are you referring to? I don't see 'initializeResult' or similar, but I do see Does that mean server was started? I see no further communication with it... |
It works! Changing the server connection from nodeIPC to stdin/stdout worked like a charm. |
Glad to hear it! I hope it will help you for the development of your server ! |
marked gradlew as executable
I got the plugin from IntelliJ plugin repo, and I'm having difficulty getting it to work with my server, perhaps you could help.
I have a Node LSP-based VSCode extension (https://github.com/wix/stylable-intelligence/). It works in VSCode format, which means a client runs the server when its activate() function is called.
Should I use the 'raw command' or 'executable' options?
Should I point the script at the client or the server?
I tried several ways, and couldn't get it to work, any tips on debugging?
Thanks
The text was updated successfully, but these errors were encountered: