codicocodes / dotfyle

Find the best Neovim plugins
https://dotfyle.com
MIT License
600 stars 29 forks source link

Incorrect LSP detection #89

Open le4ker opened 7 months ago

le4ker commented 7 months ago

Thank you for Dotfyle, it's great!

One potential bug is that it can't detect all language servers, at least in my config. For example here it detects the following language servers:

And it's missing the following ones:

Even though they seem to be included in the known language servers.

Also it detects html and graphql as a language servers even though I haven't set any such LSPs. That maybe an issue with the known language servers, since I can't find an LSP named html or graphql in Mason 😅

le4ker commented 7 months ago

Opened a PR in case the html and graphql must be removed.

le4ker commented 7 months ago

Seems like it might be parsing the mason.lua file but not the lspconfig.lua? Because all the missing LSPs are in my lspconfig, but they have a different name in the Mason config 😄

codicocodes commented 7 months ago

html and graphql are taken from here: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md not from mason

le4ker commented 7 months ago

@codicocodes thank you, I closed my PR. Why does dotfyle detect those LSPs though in my case? Also why aren't the rest LSPs detected, even though they are defined in the known language servers?

codicocodes commented 6 months ago

Detection is looking for the string 'html' or 'graphql' in your config, this works for most language servers pretty well, but for html could easily have false positives. Here is your HTML setup btw, so it is not a false positive I believe: https://github.com/le4ker/nvim-config/blob/v2.0/lua/custom/configs/lspconfig.lua#L40-L43 The graphql one could be a false positive.

Not sure about why some are not detected though, it looks like that could very well be a bug.

le4ker commented 6 months ago

Yeah I added the html LSP a couple of days ago, but it was a false positive like graphql before that.

I noticed as well that in the code it just greps for the strings, so it's strange indeed that it can't detect some LSPs 🤔

iainsimmons commented 2 months ago

Part of the issue here is that there's two different names used for some language servers, and Mason's ensure_installed takes a different format than the ones in the known language servers.

See https://github.com/iainsimmons/nvim-config/blob/main/lua/plugins/lsp.lua#L182-L202

Also, you might get some false positives if the LSP name is matched in a code comment, such as for those using the linting setup from kickstart.nvim.

Or if the filename matches the name of the language server (as was the case for astro, html and svelte in my config) and is used elsewhere (e.g. for my emmet_ls config).

My first pass with Dotfyle generated the following:

Some of which are the ones that don't use a different format for the language server name.

Here are some that are different (Mason / LSP Config):

So you almost need to match all the Mason strings too.