-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/gopls: clarify the expectation on workspace/configuration #41966
Comments
Related #38819 (comment) |
Change https://golang.org/cl/263524 mentions this issue: |
This has been discussed at length on Slack (starting at https://gophers.slack.com/archives/CRWSN9NCD/p1603374985082900), but let's move the discussion to this issue to make it a little more permanent. @myitcv said:
I agree that this is an ambiguity of the LSP, but I'm not sure how this is resolved by the |
I don't think @ianthehat (or indeed anyone) claimed it was resolved by this approach, rather that this configuration mechanism (plus the "closest match" logic) was the best approximation given the options available to us via LSP. |
Ok, then I guess it's still not clear to me that this configuration setting is offering anything more than existing per workspace folder configuration requests. I guess it saves the user the hassle of manually changing the configuration when they switch between build tags, but that feels like something that could be pushed into the level of the client. |
From memory, the idea behind this setup was that it allowed the user to concurrently edit files within a subtree of a module using a different build configuration (GOOS, GOARCH and build tags). The canonical example being the WASM subtree. Doesn't pushing this to the client mean the user would have to flip backwards and forwards as they flip to/from the subtree, thereby negating the "concurrently" bit? It's possible I'm not fully understanding the motivation behind making this change. |
By concurrently, do you mean in different sessions or in the same session? |
Same session.
But that's where I believe @ianthehat established logic to choose the view that best corresponded to the file in question. Because a view on a subdirectory tree of a module is more specific, and hence if a file is contained within that tree then that view is used. |
True. But still, it's possible to configure overlapping directories differently without a I would be very surprised if it were possible to work on the same workspace folder with different configurations in one session, and I think that's the case that this |
@myitcv: Based on this discussion, I'm still inclined to remove the configuration, as I'm still not clear on what concrete use case it supports. If you are opposed to the configuration being removed, can you please provide an example of a project in which it would be useful with an explanation of how to use it? Thanks! |
I'll defer to @ianthehat and @bhcleek on that question, because theirs was the original use case behind this (as was the original support in |
As far as I am concerned the entire thing was a GopherCon hack so we could explore and experiment, if the conclusion is that this is the wrong path to take then it should go away (even if it has been a very very long time since we started the experiment). I have certainly never used it, but then I was not the target user either. |
TL;DR: one workspace configuration per workspace is fine for vim-go. Vim-go does not need two workspaces configurations per workspace, but it does need to be able to configure multiple workspaces. IIRC correctly, |
Thanks for following up. I think it makes sense to remove the |
Change https://golang.org/cl/269597 mentions this issue: |
For each folder in workspace, gopls currently sends a
workspace/configuration
request asking for two sections (gopls
andgopls-<foldername>
). For example, this is the configuration request/response trace when there are two folders (hello and hello2).I was told the
gopls-<foldername>
section is to allow per-folder configuration. However, given thatgopls
issues multiple configuration requests for each folder, I am not sure about this.In case of vscode, it computes the effective configuration for the requested sections in the context of the requested
scopeUri
(by merging global+workspace+folder configuration) and returns the merged values. Even though this additional section request is not harmful and vscode-go can keep returning null, documenting the purpose and the expected client behavior would be nice.The text was updated successfully, but these errors were encountered: