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: add editing support for the go.work filetype #50930

Closed
4 tasks done
findleyr opened this issue Jan 31, 2022 · 7 comments
Closed
4 tasks done

x/tools/gopls: add editing support for the go.work filetype #50930

findleyr opened this issue Jan 31, 2022 · 7 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Jan 31, 2022

This is a meta issue tracking additional language features for go.work files, similar to what gopls provides for go.mod files.

The implementation of certain features (such as formatting or hover) should be very similar to go.mod files (see x/tools/internal/lsp/mod. Others may be unique to go.work. Here is a list of some features we could add -- we can open separate issues for these as needed:

  • Semantic tokens.
  • Formatting.
  • Hover (e.g. hover over a directory should tell you the module name.
  • Auto-completion (e.g. auto-complete to directories containing modules)
  • Diagnostics (e.g. a diagnostic if a directory does not contain a module). These can be scraped from the go command output or implemented ad-hoc.

@pjweinb has recently wired in LSP support for template files (see x/tools/internal/lsp/template), so may be able to advise.

CC @matloob

@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 Jan 31, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jan 31, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.8.0 Jan 31, 2022
@gopherbot
Copy link

Change https://golang.org/cl/382237 mentions this issue: gopls: recognize the go.work file type

gopherbot pushed a commit to golang/tools that referenced this issue Feb 4, 2022
For golang/go#50930

Change-Id: I5bae56853f1e913fccd559d2a553ced4200bcb35
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382237
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>
@gopherbot
Copy link

Change https://go.dev/cl/383774 mentions this issue: internal/lsp: add support for formatting go.work files

gopherbot pushed a commit to golang/tools that referenced this issue Feb 15, 2022
Wired through support for calling x/mod's go.work formatter on go.work
files into LSP. Tested it by hand in editor using the "Format Document"
command. Added a test case to workspace_test regtest, though I'm not
totally sure the test is correct.

For golang/go#50930

Change-Id: Ied052ded514bb36f561737698f0e2d7b488158e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/383774
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@findleyr findleyr modified the milestones: gopls/v0.8.0, gopls/v0.8.1 Feb 21, 2022
@gopherbot
Copy link

Change https://go.dev/cl/389301 mentions this issue: internal/lsp: add hover for go.work use statements

@gopherbot
Copy link

Change https://go.dev/cl/389317 mentions this issue: internal/lsp: report diagnostics on go.work files

@gopherbot
Copy link

Change https://go.dev/cl/390054 mentions this issue: internal/lsp: add completion for use directives

gopherbot pushed a commit to golang/tools that referenced this issue Mar 4, 2022
Report diagnostics on use lines where the directory doesn't have a
go.mod file, and on syntax errors in go.work.

For golang/go#50930

Change-Id: Idab36b43d86c4842f8eecd5c071ce0587e6f27b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389317
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopherbot pushed a commit to golang/tools that referenced this issue Mar 4, 2022
Show the module path of the module being used.

For golang/go#50930

Change-Id: I90a67e12182ffb457876b1fbc95aeb56ff632878
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389301
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link

Change https://go.dev/cl/390594 mentions this issue: package.json: reuse go.mod tmGrammar for go.work syntax highlight

gopherbot pushed a commit to golang/vscode-go that referenced this issue Mar 8, 2022
This handles syntax highlighting in VS Code Go when
users don't opt in for semantic tokens to be implemented
in golang/go#50930.

The go.mod and go.work syntaxes are currently identical except
the keywords.

Change-Id: I9395588c9291f88ed2690e939bf486f626e12a4c
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/390594
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
gopherbot pushed a commit to golang/tools that referenced this issue Mar 10, 2022
For golang/go#50930

Change-Id: I9def58e9406ee735c93e988de336dbfee37e6c95
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390054
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@findleyr
Copy link
Contributor Author

Let's close this as-is for now. We can file a separate issue for follow up.

@rsc rsc unassigned matloob Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants