-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: compare config.cmd/cmd_env to check if new client should be spawned #2417
base: master
Are you sure you want to change the base?
Conversation
it's not in lsp spec. why do you think it's not problem of server. the language server should implement the |
The problem is that I need to run separate
There is no way for |
clangd doesn't rely heavily on the workspace folder, but finds projects by looking for compilation databases relative to source files. It already supports multiple compilation databases, e.g. if you open files in multiple directories, each with |
I know, but I am compiling the projects for different architectures, e.g. projectA is for host system, while projectB e.g. for ARM embbedded microcontroller. In docker I have |
But regardless of my concrete setup with |
the |
This is currently checked in this part: cmd = eq.type_dispatch { -- string[] | (function(dispatchers: table): table) (see vim.lsp.start_client)
['function'] = function() return true end, -- for now don't check the function case, just assume equal
table = eq.list(eq.builtin),
}, So currently we're not handling function, we just assume they are equal (so this would just use workspace folders). I am not sure if anywhere in lspconfig |
thanks for the help. but this is far too much code. nvim-lspconfig should not be complicated, it's just a collection of configs. is the comparison/merge code something that is needed in the Nvim Lua stdlib? for reference:
is there some missing LSP feature that is needed in Nvim LSP core (not lspconfig)? |
86b0239
to
24876c4
Compare
Thanks for suggestion, didn't know about I don't think this is something related to LSP core as from what I understand core doesn't support multiple |
24876c4
to
8df907d
Compare
well, is that an intentional design constraint of vim.lsp (cc @mfussenegger )? I don't see any (obvious) discussions: https://github.com/neovim/neovim/search?p=2&q=multiple+workspaceFolders&type=issues in general, adding features into nvim-lspconfig is not the right approach. if a feature is missing in core Nvim LSP, we need to ask why. creating a parallel universe in nvim-lspconfig complicates everything. nvim-lspconfig should be just a collection of configs for vim.lsp. It is not intended to add missing features to vim.lsp. |
#2418 maybe can fix this. |
Well, to be fair I don't really know much about the I think #2418 is just a temporary fix. Yes, it would fix my current problem because it would disable handling of To give some more context, here is some (simplified) info about my setup (and why there is a problem):
{
"clangd": {
"cmd": [
"docker",
"run",
"my-image",
"clangd",
"--path-mappings=host/dir=container/dir"
]
}
}
This way I can have project local So if any other user uses Regarding LSP functionality in Neovim core: as far as I understand it lspconfig contains a list of server configurations and also provides maneger that keeps track of LSP-to-root_dir mapping etc. However if that's already implemented in Neovim core, then I have to revisit my LSP configuration as I would prefer using lspconfig only as a "list of configurations". Also, having some generalized "project local settings" functionality in Neovim core would be great, but I know it's a big thing. With the recent addition of |
Neovim core supports multiple workspace folders, but it's up to the user to manage it. What we could do in core is to add some further convenience to auto-extend the workspace folders if |
I am using
on_new_config
to determine the command used to spawnclangd
depending onroot_dir
(insidedocker
or on host). With the recent addition of multi-workspace support, now the first spawnedclangd
will be serving all files, even if for some I would like a separateclangd
insidedocker
container.This PR attempts to solve the problem by comparing more configuration keys when checking if a client from cache can be used. I added comparison of
cmd
,cmd_env
,cmd_cwd
(if not nil) andsettings
(deep comparison).I am not sure if this is the correct way of solving the issue, but it seems to work well with my setup.
I noticed one issue:
LspInfo
showsroot_dir
correctly only for the server that is attached to the current buffer. For example, when I have server A for buffer 1 and server B for buffer 2, thenLspInfo
showsRunning in single file mode.
for A when called from buffer 2, and for B if called from buffer 1, so it seems that root_dir is picked depending on current buffer. But I think this is only forLspInfo
as lsp features seem to work well.