Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostic and actions handlers are missing #5

Closed
lucax88x opened this issue Dec 14, 2020 · 7 comments
Closed

Diagnostic and actions handlers are missing #5

lucax88x opened this issue Dec 14, 2020 · 7 comments

Comments

@lucax88x
Copy link

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

@lucax88x
Copy link
Author

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
Copy link
Owner

ojroques commented Dec 14, 2020

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
Copy link
Author

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
Copy link
Owner

ojroques commented Dec 14, 2020

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
Copy link
Author

TSServer has a lot of actions.

Tomorrow morning I'll try your branch.

@lucax88x
Copy link
Author

Almost perfect.

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

@ojroques
Copy link
Owner

ojroques commented Dec 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants