When I use multiple folders in one workspace with gopls sometimes a window pops up with the error:
Your workspace root is X, but your module root is Y. Please add Y as your workplace folder.
This happens on OSX and I'm using go modules (i.e. neither X nor Y are in the GOPATH).
I found a couple of issues that sound related and it is also mentioned in the troubleshooting section (https://lsp.readthedocs.io/en/latest/troubleshooting/). However all the issues have been merged/closed quite a while ago.
This is due to this plugin only handling the first workspace folder (of the sublime project).
Since most language servers only understand one workspace folder, and not multiple like gopls, the plan is to move towards a one-server-per-workspace-folder approach.
There's a PR here that actually implements one-server-per-window (so gopls should work with that), but research shows that many language servers don't, haven't, or are not willing to implement such complexity.
It also makes sense to put that complexity at the text editor client, since there are many more language servers than text editors.
I did some exploration enabling per-folder sessions and multi-folder sessions (gopls) in a branch https://github.com/tomv564/LSP/tree/multi-workspace-folder. I'd like to move towards implementing this mechanism this week.
@JonasPf do you have this package installed from git? Could you test it out?
@tomv564 using with PHP and some basic JS the multi-workspace-folder branch is working fine.
But I think, it need more testing.
Just installed it from the branch and so far it's working fine with gopls. I'll be using this over the next days and will report here.
Oh, in the bottom line it says:
gopls, gopls, gopls, gopls, gopls, gopls, Line XXX, Column XXX
Is that supposed to look like that? I have 6 folders in the workspace (but only 5 of them are a go projects, 1 is just my personal markdown notes)
@JonasPf thanks for reporting, the changes are now in master.
Can you tell if the "gopls, gopls, gopls .." issue persists there?
Most helpful comment
I did some exploration enabling per-folder sessions and multi-folder sessions (gopls) in a branch https://github.com/tomv564/LSP/tree/multi-workspace-folder. I'd like to move towards implementing this mechanism this week.
@JonasPf do you have this package installed from git? Could you test it out?