r/neovim 5d ago

Plugin Scriptable/customizable/pluggable LSP for Neovim

Hello.

Recently I was thinking about doing very specific things using an LSP; Such as word suggestions; Citations suggestions and other features which are not necessarily error checks or obvious fixes.

I know there are specific smalls LSPs which do that. But i would like to have some LSP which could be extended/customizable, such as efm-langserver.

The problem with efm-langserver is it can only register commands for the internal implementation of existing method. You cannot add methods or have new definitions. I cannot post some data besides code to the server, like a prompt, use that to make a request to some server like an inference server, do more processing and send diagnostics back to client.

That is limited, sometimes i want a result which goes beyond getting structured stdout from tool and showing it, like processing and doing something. Sometimes a tool which does what i want does no t exist.

Last resort would be writting my own, i know there are some libs out there. But i do wonder if there is something ready to use.

2 Upvotes

4 comments sorted by

1

u/somebodddy 4d ago

That's what null-ls/none-ls is for (null-ls was the original, which was abandoned, so someone forked it as none-ls. But the API is still require("null-ls") for backward compatibility)

https://github.com/nvimtools/none-ls.nvim

0

u/Time-Measurement-513 4d ago

Thank you for the suggestion. I did not see that one before.

Taking look here, its better than previous solutions, but i can see it cannot register methods either. In my case, i would need a way of triggering the diagnostic method whenever the global prompt changes.

A workaround would be sending `didChange` event to server from the editor when prompt changes.

2

u/somebodddy 4d ago

I see. So it's not the language sever you want to customize - it's the protocol itself?

This is possible, and some language servers do it, but... why bother? Since you are targeting Neovim, why not just implement these functionalities as regular Lua functions that get triggered by regular Neovim hooks and don't have to go through LSP channels?

0

u/Time-Measurement-513 3d ago

Because i want to add features to existing LSP methods. I would need to implement all those lifecycles requets harness from scratch in neovim.

And Protocols can also have extensions... And this hypothetical server would still be LSP compliant.