Skip to content
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: support opening a directory that contains a single module #42108

Closed
stamblerre opened this issue Oct 21, 2020 · 4 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Soon This needs to be done soon. (regressions, serious bugs, outages) Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

A common workflow is opening a directory that contains a module in a subdirectory. Currently, this is only supported with experimentalWorkspaceModule enabled, but we should support this in any mode. This is effectively the reverse of expandWorkspaceToModule.

With multiple modules, this will not work without experimentalWorkspaceModule. Note that we may need handling if the user creates a new module in a higher level directory during the session.

@stamblerre stamblerre added this to the gopls/vscode-go milestone Oct 21, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Oct 21, 2020
@stamblerre stamblerre added the Soon This needs to be done soon. (regressions, serious bugs, outages) label Oct 28, 2020
@gopherbot
Copy link

Change https://golang.org/cl/268877 mentions this issue: internal/lsp: nest the workspace root if there is only one module

@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default Nov 10, 2020
@stamblerre stamblerre moved this from Needs Triage to Critical in vscode-go: gopls by default Nov 10, 2020
@stamblerre stamblerre moved this from Critical to In progress in vscode-go: gopls by default Nov 10, 2020
vscode-go: gopls by default automation moved this from In progress to Done Nov 23, 2020
@ppggff
Copy link

ppggff commented Dec 1, 2020

How do I specify which subdirectory?
I have a project with go.mod in the src subdir, and some mod cache in pkg dir, such as:

/src
      go.mod
/pkg/mod
      cache
      github.com

@stamblerre
Copy link
Contributor Author

I would suggest just opening the src directory if you only intend to edit that module--there is no way to configure a module for gopls to choose.

@indierojo
Copy link

Thanks for adding this! Great QoL fix for a few of my projects - it works exactly as I would expect.

@golang golang locked and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Soon This needs to be done soon. (regressions, serious bugs, outages) Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

5 participants