-
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: update editor instructions for go.work #50955
Comments
Change https://golang.org/cl/382242 mentions this issue: |
For golang/go#50955 Change-Id: Idab88d258ceab3312adccd97eb58ed64e5fb5053 Reviewed-on: https://go-review.googlesource.com/c/tools/+/382242 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
gopls now supports go.work files at master. @muirdm or @bcmills, would you be able to update our emacs documentation at some point in the next few weeks? No worries if not -- I can figure it out -- but I know you have contributed to that documentation before. See the edit in the top comment and the associated CL for coc.nvim for more information. |
@dr2chase do you know if sublime has heuristics for deriving the workspace folder? If so, could you help update the sublime documentation? |
I have not yet learned about Go workspaces, so I am a bit in the dark here. Seems like I should look at this. |
I haven't updated my own (I suspect that it will involve another parallel implementation of the |
Change https://go.dev/cl/388576 mentions this issue: |
For golang/go#50955 Change-Id: I8882239868d060a444466a466d30c3de9aaa31ef GitHub-Last-Rev: 6395f14 GitHub-Pull-Request: #370 Reviewed-on: https://go-review.googlesource.com/c/tools/+/388576 Trust: Nooras Saba <saba@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Follow-up -- for the case of the Go source tree, with go.work =
and Sublime/LSP tweaked to use gopls@latest (and the sublime editor instructions for gopls include that) it all seems to "just work". Is that what we want, or were we looking for something more? |
@dr2chase "Just works" is good enough for me! Thanks for trying it out. |
Some (but not all) editor instructions have been updated. Moving this to the next milestone. |
As per golang/go#50955 govim now uses the directory of GOWORK if set before falling back to use the directory of GOMOD. The added test also introduced a new testscript test feature, setting which directory vim should start from.
As per golang/go#50955 govim now uses the directory of GOWORK if set before falling back to use the directory of GOMOD. The added test also introduced a new testscript test feature, setting which directory vim should start from.
As per golang/go#50955 govim now uses the directory of GOWORK if set before falling back to use the directory of GOMOD. The added test also introduced a new testscript test feature, setting which directory vim should start from.
FWIW, using emacs+gopls with (prior to this, I was using vendored deps so I couldn't use the Project structure
Modules
Setting up workspaces with
|
@jguenther thanks for that, we can include this in our editor instructions. Do you know if using projectile is strictly required for this to work? CC @adonovan (another eglot user) |
Keeping this open to track additional documentation for other editors, but it is a lower priority now. |
Some language-agnostic LSP clients need to be configured with root patterns (e.g. open the workspace to the folder containing
go.mod
).We should update those to account for using
go.work
as the workspace root.EDIT: the main things to look for are:
go.work
file (i.e. find nearest go.work file up the directory hierarchy). If no such directory exists, they should repeat withgo.mod
. Unfortunately, not all LSP clients support this multi-phase search, so an alternate heuristic is to take the farthest directory up the directory hierarchy that contains either ago.work
file orgo.mod
file.go.work
files and send the"go.work"
language identifier. This is much less critical than (1) -- clients could also do this forgo.mod
files and AFAIK none of them do, except VS Code.The text was updated successfully, but these errors were encountered: