Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lsp4e-dev] Testing/Debugging Language Servers

Hey!

In the Spring Tools, we do two things here:

- the first part is that we implemented a switch inside of our ProcessStreamConnectionProvider that instead of launching the language server, it connects to an already existing socket server. The same switch exists in the language server, so that we can start the language server in a socket-server mode, so that instead of using stdin/out for the connection, it opens a server socket to listen for connections. That allows us to run the language server as a regular app from the IDE (e.g. in debug mode) and then run the IDE afterwards, opening files, and therefore causing the IDE to connect to the LS. This is especially nice when working a lot on the language server.

- the second part is that we implement unit tests for the language server (to test it), in which we try to look at the language server from the outside (the LS API).

Cheers
Martin



Am 15.04.2021 um 20:35 schrieb Yash Bharatiya <yashsoc@xxxxxxxxx>:

Hello All,
I have been trying to understand Language Servers, its protocol for Java, how they are implemented and just wanted to know how all the other devs are debugging language servers like jdt-ls or lemMinx(basically how you make changes and test them out).

What I'm doing right now is -
1) Create a plugin project for testing the server
2) Defining lsp4j, contentTypes, generic editors as extensions in plugin.xml
3) Make a class say XMLConnectionStreamProvider and extend it with ProcessStreamConnectionProvider in lsp4e
and declare the path to uber jar or a snapshot jar in the commands.
4) Finally I run the plugin as an Eclipse Application
and open a file of the type mentioned in the plugin
and test the code actions provided by the server.(I bind the
language server for the file by going to Preferences to the server I want to debug)

Is this the right approach, or is it possible to debug the code actions from the server in an easier way?
Would appreciate any help, so that I can move on to contributing.

Thanks,
Yash
_______________________________________________
lsp4e-dev mailing list
lsp4e-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/lsp4e-dev


Back to the top