meuter / lualine-so-fancy.nvim

Small collection of _fancy_ components for the lualine.nvim plugin.
MIT License
73 stars 4 forks source link

fix(fancy_lsp_servers): cleaner way of fetching null-ls sources #1

Closed pysan3 closed 1 year ago

pysan3 commented 1 year ago

Thank you for the amazing plugin!

Bug

According to null-ls docs, the official way of fetching null-ls sources is to use the get_source(query) function instead of directly accessing builtins table.

https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/SOURCES.md

The biggest difference is that the current method does not distinguish sources that are disabled while results that return from get_source are already filtered internally.

Fix

This PR uses get_source function with query of filetype instead.

One breaking change is that the previous code only listed sources of formatting and diagnostics but now it lists all sources (i.e. from code_actions, completion, hover as well)

Is there any reason you were filtering?

Note

Out of the scope of this PR but I just wanted to inform you that vim.lsp.buf_get_clients(bufnr) has been deprecated since nvim-0.9.0 to be replaced by vim.lsp.get_active_clients({ bufnr = bufnr }). Ref

I'll leave it to you whether to fix it or not.

meuter commented 1 year ago

Thanks for this! Much cleaner now ;-)