uniconproject / unicon

http://www.unicon.org
Other
57 stars 28 forks source link

Setting up ulsp on Neovim #457

Closed IanTrudel closed 5 months ago

IanTrudel commented 6 months ago

Anyone has got ulsp working on Neovim? Neovim expects to connect to an LSP server through [vim.lsp.rpc.connect()](https://neovim.io/doc/user/lsp.html#vim.lsp.rpc.connect()) but ulsp is not listening on the port given. It seems that despite having a server.icn, it is actually a client.

./ulsp --socket 6010
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused
open(:6010) ERROR: Connection refused
Jafaral commented 6 months ago

The lsp server was developed with an vscode extension, and you are right, it does open the socket as a client back to the vscode extension. It is easy to to add an option to run the socket in server mode.

Regardless who open the socket, the lsp is still implementing the server side of the lsp protocol, i.e, responding to the client requests.

Jafaral commented 6 months ago

@mstreeter10 , is it possible to change the lsp socket to run in server mode even with vscode? In all cases, we should add an option to open to open the socket in server mode to accept connections.

IanTrudel commented 6 months ago

Thank you @Jafaral. It should be mentioned that make INSTALL does not install ulsp either. Would be nice.

Jafaral commented 6 months ago

ulsp and udap are still in beta and we haven't added them to make install. udap was actually dropped in recent week in favor of udb --adapter option. So things are still in flux. Until now, we assumed if you are using those you know what you are doing or at least you come and ask questions. If you can get any of these to work with vim, that would be great. emacs and sublime text are on my radar too.

Jafaral commented 6 months ago

BTW, we also haven't tried running ulsp and udap out of tree, so expect failure there too.

IanTrudel commented 6 months ago

There are so many hidden gems in Unicon. A recent commit revealed the LSP. I wouldn't have known otherwise.

BTW, we also haven't tried running ulsp and udap out of tree, so expect failure there too.

You may have noticed that I have a knack for finding failures. :)

RE: vim

I will gladly share my Neovim configuration once it works.

Jafaral commented 6 months ago

adding -s as an option is also acceptable. I kinda like the idea of being able to do it both ways so we can support multiple use cases. @mstreeter10 , we can do ulsp -s --socket PORT, and make that open PORT in listen mode, instead of connecting to PORT. Similar to how we do udb --adapter which I think runs in server mode by default.

mstreeter10 commented 6 months ago

Ideally, the language server would run as a server by default. I'll look into this. VSCode should be able to operate with the language server running as a server with a few tweaks to the extension. Adding a -c to run in client mode makes more sense to me and to just have the server run as a server by default.

IanTrudel commented 6 months ago

Ideally, the language server would run as a server by default. I'll look into this.

Take note that most language servers are dealing with stdin and stdout. This would be the easiest way to configure.

Godot is one of the rare LSPs to use a TCP connection, allowing an external editor to use it. All other LSPs I use are using stdin/stdout (C/C++/C#, Rust, Python, etc.)

Either way is fine with me but it's worth mentioning.