This is especially useful for resource-hungry clients, like rust-analyzer or haskell-language-server, in order to avoid spawning multiple clients.
Using lsp.Client.config.root_dir as the source of truth results in this plugin detecting the wrong project root in this scenario.
This PR fixes that, by first searching through the lsp.Client.workspace_folders,
and then falling back to the config.root_dir if no matching workspace folder is found.
Some LSP clients can have more than one workspace folder, which can be added via
workspace/didChangeWorkspaceFolders
.This is especially useful for resource-hungry clients, like rust-analyzer or haskell-language-server, in order to avoid spawning multiple clients.
Using
lsp.Client.config.root_dir
as the source of truth results in this plugin detecting the wrong project root in this scenario.This PR fixes that, by first searching through the
lsp.Client.workspace_folder
s, and then falling back to theconfig.root_dir
if no matching workspace folder is found.