Closed benlubas closed 1 week ago
The (params of the) request is modified here:
https://github.com/jmbuhr/otter.nvim/blob/5f03444012b44f3715413f51b47ba2b3607cd1be/lua/otter/lsp/init.lua#L126-L147
and then passed on to the lsp server responsible for the language
https://github.com/jmbuhr/otter.nvim/blob/5f03444012b44f3715413f51b47ba2b3607cd1be/lua/otter/lsp/init.lua#L147
Notably the handler
that buf_request
gets will be the handler we defined for the otter-ls server
https://github.com/jmbuhr/otter.nvim/blob/5f03444012b44f3715413f51b47ba2b3607cd1be/lua/otter/lsp/init.lua#L21
which in turn modifies the response if necessary and then passes it on to the default handler (vim.lsp.handlers
). If otter-ls doesn't have a handler for the request method it goes straight to the default handler.
See the second diagram here: https://github.com/jmbuhr/otter.nvim?tab=readme-ov-file#a-group-of-otters-is-called-a-raft
Ahhh, I understand now. That's a little weird to wrap my head around. Unfortunately this and what I'm trying to do are quite a bit different I think.
Thank you for the explanation!
Firstly, #137 is super cool, I saw it and did something similar to add some refactoring features to Neorg in a native LSP way. I'm now exploring making Neorg's completion source LSP native in the same way Otter did.
I see these comments, but I'm unsure of what code they're referring to.
Would you mind linking some of the code that's related to completions?