ojroques / nvim-lspfuzzy

A Neovim plugin to make the LSP client use FZF
BSD 2-Clause "Simplified" License
316 stars 11 forks source link

Diagnostic and actions handlers are missing #5

Closed lucax88x closed 3 years ago

lucax88x commented 3 years ago

Do you plan to support those handlers in the near future or are they out of scope?

lucax88x commented 3 years ago

I am trying to do it myself, but I'm pretty newb with plugins in general, how can I source my luafile and overwrite handlers to test it?

ojroques commented 3 years ago

The issue is that Neovim LSP does have a function to retrieve all diagnostics (vim.lsp.diagnostic.get()) but the handler associated to that function is used to display warnings/erros next to the code so we don't want to mess with that.

So this means we have to create our own command which would call vim.lsp.diagnostic.get() and process the results. It shouldn't be complicated, I'll do it this week or the next.

About code_action I don't really see the point of using FZF in that case. There is no location to jump to, there is just a list from which to select an action. It's quicker to type 2 to select action 2 than to use FZF I'd say. So it's not a priority but maybe I'll add a command after the one for diagnostics.

Check :h lsp-handler for creating your handlers and :lua-require for how lua files are sourced. Basically everything under <neovim config folder>/lua should be sourced.

lucax88x commented 3 years ago

Regarding diagnostic, Yeah, I think we could be fine by just providing a EX command that we can use in our remaps instead of using handlers. Regarding actions, well, to me it happens to have also 10 actions to select from, and FZF can be helpful to filter quickly, and in general to have an unique "popup" system.

ojroques commented 3 years ago

I'm working on both right now in branch dev you can try it out.

Diagnostics works fine, I've added :LspDiagnostics <bufnr> and :LspDiagnosticsAll commands.

I haven't tested code actions yet because my LSP servers don't support them. Can you suggest me a LSP server which have some code actions I can try?

lucax88x commented 3 years ago

TSServer has a lot of actions.

Tomorrow morning I'll try your branch.

lucax88x commented 3 years ago

Almost perfect.

One side note, if there are no actions, I would print a message.

ojroques commented 3 years ago

I've merged dev into main, now the plugin supports diagnostics and code actions. I've also added some logs if there is no code actions or references etc.