-
Notifications
You must be signed in to change notification settings - Fork 305
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
Support multi-root workspaces #1069
Comments
Waiting on reply for this first. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@prabirshrestha: it looks like the Vim issue itself is stale. What is the path forward on this topic? |
I"m looking into trying to run multiple servers so you can edit multiple projects at once in the same session but with different root_uri and instead servers are then looked up by root_uri and not filetype/server_name. I just want LSP functions to persist between multiple projects of same filetype I can run 2 gopls servers with different root_uri, but I also receive response from both at the moment (locationlist opens with 2 results for goto-definition for example) so I will have to look into adapting that code as well. I hope its possible :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@prabirshrestha I think the stale bot is pinging you :) |
dezza/vim-lsp-settings@6c9ecc0
I did something like this back when I got multiple servers per root_uri working - naming each server with their root_uri. The most cumbersome is enabling the lsp server as vim-lsp assumes one server and the same for terminating the servers. The servers are terminated fine when you :bdelete a buffer as far as I remember, but there might be other cases it doesn"t as I saw a few servers spawned. Another caveat to this is that it starts another server for every goto-definition for imported stdlibs which I didn"t see an obvious way to fix (How to tell if its a stdlib that can be resolved by same server? Or how to tell if its NOT a stdlib?) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I haven"t had time to finish this, I don"t know this project well enough to know what parts it would affect without trial and error. But it is #1 reason my friends are staying on coc.nvim which does something similar. The goto-definition question seems to be the hardest to get right (only start a new server if its not a stdlib where you can reuse any server really) vim-lsp has assumption of 1 server per language. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I tried looking at neovim"s dictionary watch but it isn"t a straight port. So if someone is willing to have custom apis for workspace more than happy to include it without waiting for vim to have a specific api for it. |
Yes, please :) The lack of multi-root support is the main reason why I still use coc.nvim instead of lsp.vim. |
I looked at the spec and seems like it isn"t hard to implement and can be done without waiting for upstream vim support. Before we begin the implementation can folks tell me how they are using it in other editors/lsp client? Even better if you have a sample repo that you can share.
Basically is it automatically or manually detecting the appropriate workspace folders and if automatic how good is it at. Definitely a good one to have as a high priority. |
I use it mostly because I use ’gd‘ to look up in imported libs and
the corner case is sometimes these are stdlib (which should be ignored and
not have their own root_uri nor server as they already work and resolved as
expected), that is the gotcha when you start multiple servers you don"t
need more than 1 for stdlib.
The only thing that matters to me is to be able to do use all lsp functions
when I gd into imported libs which are not stdlibs (e.g thirdparty or own
local separate package), I expect it to "just work", but I do not mind a
toggle global setting for it.
The rest I do not have an opinion about.
|
@dezza can you let me know which lang server you are using so we can verify it when we do add this feature. |
gopls mainly |
It sounds like there are two aspects to multi-root support:
Personally I only need the core support, i.e. a way to tell vim-lsp about my root folders. I don"t mind about auto-detection (as long as there is a way to disable it), but I have no opinion about how it should work. Note that auto-detection is a feature on top of the core support, so IMHO it makes sense to start with core support and re-assess later if auto-detection is really needed. |
Auto-detection is however the reason people are using coc.nvim and other solutions instead, because it just works. There are far too many languages where its quite the showstopper as soon as you have things divided in different packages and hardcoding is too much tinkering per active project you develop on, it will become real messy quick. |
Please give #1265 a try for initial workspace folder support. Instructions in the PR. |
This is now supported in master, please refer to #1265 on the usage. |
I uninstalled vim-lsp-settings and tried the settings from the PR. I also tried vscode on the side to verify how gopls works. The workflow on vscode was to I guess the root_uri is only set up the first time the server is launched, thats why it doesn"t work like I expect. What I expect is that when I open a first file That works as expected in vscode (after adding the second project to workspace). In coc.nvim I guess they start multiple servers for whatever reason. The solution must be to use the upcoming "add folder to workspacefolder" to add folders as buffers are opened and then it should work like vscode or coc.nvim I hope. |
This is more or less the same as #157: please add support for multi-root workspaces.
Since Vim does not provide support for workspaces, I think the best (and only?) approach is to support it at the LS client level, i.e. vim-lsp. This could be as simple as supporting a global variable (e.g.
g:WorkspaceFolders
) containing a list of root folders.FYI, this is how coc.nvim does it: https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders
The text was updated successfully, but these errors were encountered: