Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lsp): prioritise
workspace_folders
for root directory detection
Some LSP clients can have more than one workspace folder, which can be added via [`workspace/didChangeWorkspaceFolders`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#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 the `config.root_dir` if no matching workspace folder is found.
- Loading branch information