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 all features on the command line #32875

Closed
stamblerre opened this issue Jul 1, 2019 · 36 comments
Closed

x/tools/gopls: support all features on the command line #32875

stamblerre opened this issue Jul 1, 2019 · 36 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. help wanted NeedsFix The path to resolution is known, but the work has not been done.

Comments

@stamblerre
Copy link
Contributor

gopls features like find references, rename, etc. should work on the command line. Support for them should be added to internal/lsp/cmd. Right now, only definition and format are supported.

@gopherbot gopherbot added this to the Unreleased milestone Jul 1, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jul 1, 2019
@stamblerre stamblerre added Suggested Issues that may be good for new contributors looking for work to do. NeedsFix The path to resolution is known, but the work has not been done. labels Jul 10, 2019
@stamblerre stamblerre added help wanted and removed Suggested Issues that may be good for new contributors looking for work to do. labels Aug 8, 2019
@hartzell
Copy link

hartzell commented Sep 6, 2019

If no one's working on it, I'll take a swing at adding rename. Looks like it's a matter of adding an internal/lsp/cmd/rename.go that defines a type rename struct {...} and fleshing out a Run method for it. Looks like the rename machinery wants to work from a position, seems like I can mimic/steal what the query definition subcommand uses. Anything I'm missing?

@hartzell
Copy link

I'll take a swing at adding rename

This has been merged, see golang/tools#157. Great support for a first time contributor.

@rentziass
Copy link
Contributor

If no one's on it, I'd give references a spin 😊

@stamblerre
Copy link
Contributor Author

@rentziass: Absolutely, please do! Feel free to reach out with any questions here or on the Gophers Slack (https://invite.slack.golangbridge.org/).

@kalmanb
Copy link

kalmanb commented Oct 17, 2019

@stamblerre any others need implementation?

@stamblerre
Copy link
Contributor Author

Anything that doesn't have a test in this file is available: https://github.com/golang/tools/blob/e4d7c6f25b8e08c4784d6585835a053ae0ad53bb/internal/lsp/cmd/test/cmdtest.go#L41. I would suggest Import or SuggestedFix as a useful next feature.

@kalmanb
Copy link

kalmanb commented Oct 18, 2019

Great, thanks I'll SuggestedFix a go.

@gopherbot
Copy link

Change https://golang.org/cl/202178 mentions this issue: tools/gopls: add cmd support for references

@gopherbot
Copy link

Change https://golang.org/cl/202480 mentions this issue: tools/gopls: add command line support for suggestedfix

@kalmanb
Copy link

kalmanb commented Oct 22, 2019

I'll also take a look at Import and Link

kalmanb added a commit to kalmanb/tools that referenced this issue Oct 22, 2019
This adds support for calling import from the gopls command line,
e.g.

$ gopls imports -w ~/tmp/foo/main.go

Optional arguments are:
-w, which writes the changes back to the original file; and
-d, which prints a unified diff to stdout
With no arguments, the changed files are printed to stdout.

Updates golang/go#32875
@gopherbot
Copy link

Change https://golang.org/cl/202624 mentions this issue: tools/gopls: add command line support for imports

@rentziass
Copy link
Contributor

I'll keep going with SignatureHelp and Symbol then :)

kalmanb added a commit to kalmanb/tools that referenced this issue Oct 24, 2019
e.g.

$ gopls links ~/tmp/foo/main.go

Optional arguments are:
-json, which emits range and uri in JSON
With no arguments, a unique list of links are emitted.

Updates golang/go#32875
@gopherbot
Copy link

Change https://golang.org/cl/203297 mentions this issue: tools/gopls: add command line support for imports

gopherbot pushed a commit to golang/tools that referenced this issue Oct 25, 2019
This change adds command line support for references.

Example:

$ gopls references ~/tmp/foo/main.go:8:6
$ gopls references ~/tmp/foo/main.go:#53

Updates golang/go#32875

Change-Id: I9a0cf6ae8ba0a5c3d4ffc829b96fe3b42297c192
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202178
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/203609 mentions this issue: tools/gopls: add cmd support for symbols

@gopherbot
Copy link

Change https://golang.org/cl/204057 mentions this issue: tools/gopls: add cmd support for signature

@jbszczepaniak
Copy link

jbszczepaniak commented Nov 22, 2019

O, I see, right. It seems that these are yet to be done:

  • Completion
  • CompletionSnippet
  • UnimportedCompletion
  • DeepCompletion
  • FuzzyCompletion
  • CaseSensitiveCompletion
  • RankCompletion

I will take from the list - Completion

@rentziass
Copy link
Contributor

@jbszczepaniak I'm currently working on Completion, see a couple of comments above :)

@jbszczepaniak
Copy link

jbszczepaniak commented Nov 22, 2019

🤦‍♂ ok. I believe this is a list (right?):

  • CompletionSnippet
  • UnimportedCompletion
  • DeepCompletion
  • FuzzyCompletion
  • CaseSensitiveCompletion
  • RankCompletion

Thus I will take CompletionSnippet

@stamblerre
Copy link
Contributor Author

@rentziass: Do you intend to add all of the completion related test code in your CL? In that case, I believe that this issue could be considered done.

@rentziass
Copy link
Contributor

I'd surely like to try :)

@jbszczepaniak
Copy link

jbszczepaniak commented Nov 22, 2019 via email

rhnvrm added a commit to rhnvrm/tools that referenced this issue Nov 25, 2019
gopherbot pushed a commit to golang/tools that referenced this issue Nov 25, 2019
This change adds command line support for implementation.

Example:

$ gopls implementation ~/tmp/foo/main.go:8:6
$ gopls implementation ~/tmp/foo/main.go:#53

Updates golang/go#32875

Change-Id: I3aa89a788ded886368b07c1824325069f3cba88a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208357
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
gopherbot pushed a commit to golang/tools that referenced this issue Nov 26, 2019
This change adds command line support for highlight.
Provided with an identifier position, it will display
the list of highlights for that within the same file.

Example:

$ gopls highlight ~/tmp/foo/main.go:3:9
$
$ 3:9-6:0
$ 10:22-11:32
$ 12:10-12:9
$ 12:20-30:0

Updates golang/go#32875

Change-Id: I5de73d9fbd9bcc59a3f62e7e9a1331bc3866bc75
Reviewed-on: https://go-review.googlesource.com/c/tools/+/207291
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
rhnvrm added a commit to rhnvrm/tools that referenced this issue Jan 23, 2020
rhnvrm added a commit to rhnvrm/tools that referenced this issue Jan 24, 2020
rhnvrm added a commit to rhnvrm/tools that referenced this issue Jan 31, 2020
rhnvrm added a commit to rhnvrm/tools that referenced this issue Feb 4, 2020
gopherbot pushed a commit to golang/tools that referenced this issue Feb 4, 2020
This change adds command line support for prepare_rename.

Updates golang/go#32875

Change-Id: I7f155b9c8329c0faa26a320abab162730a7916ad
GitHub-Last-Rev: 118e846
GitHub-Pull-Request: #188
Reviewed-on: https://go-review.googlesource.com/c/tools/+/207579
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@daisuzu
Copy link

daisuzu commented Mar 14, 2020

I'll do workspace/symbol.

daisuzu added a commit to daisuzu/tools that referenced this issue Mar 21, 2020
This change adds command line support for workspace/symbol.
Symbols are formatted as '{span} {name} {type}'.

$ gopls workspace_symbol -matcher fuzzy 'wsymbols'
$
$ workspacesymbol/a/a.go:5:7-31 WorkspaceSymbolConstantA Constant
$ workspacesymbol/b/b.go:5:6-28 WorkspaceSymbolStructB Struct

Optional arguments are:
-matcher, which specifies the type of matcher: fuzzy, caseSensitive, or caseInsensitive.
The default is caseInsensitive.

Updates golang/go#32875

Change-Id: Ieef443b13710f9c973210e58f66ab7679f258b30
@gopherbot
Copy link

Change https://golang.org/cl/224677 mentions this issue: tools/gopls: add cmd support for workspace_symbol

gopherbot pushed a commit to golang/tools that referenced this issue Mar 26, 2020
This change adds command line support for workspace/symbol.
Symbols are formatted as '{span} {name} {type}'.

$ gopls workspace_symbol -matcher fuzzy 'wsymbols'
$
$ workspacesymbol/a/a.go:5:7-31 WorkspaceSymbolConstantA Constant
$ workspacesymbol/b/b.go:5:6-28 WorkspaceSymbolStructB Struct

Optional arguments are:
-matcher, which specifies the type of matcher: fuzzy, caseSensitive, or caseInsensitive.
The default is caseInsensitive.

Updates golang/go#32875

Change-Id: Ieef443b13710f9c973210e58f66ab7679f258b30
Reviewed-on: https://go-review.googlesource.com/c/tools/+/224677
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Jun 24, 2020
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
@mattheusv
Copy link

Anyone is working on Completion? If not I can try to implement.

@stamblerre
Copy link
Contributor Author

No, I don't believe anyone has worked on completion, so please feel free to work on it.

@findleyr
Copy link
Contributor

Circling back, I don't think we should do this.

Supporting features on the command line has a real cost:

  • we need to implement and maintain versions of our test runner for each feature
  • we increase our API surface area

But on the other hand, I never see requests for additional command-line features. So absent specific requests, I think we should not change the CLI.

Tentatively closing this issue as it doesn't seem actionable. If you are reading this and wish that gopls had a specific command-line feature, please file a separate issue.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2022
@golang golang locked and limited conversation to collaborators Aug 14, 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. help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

10 participants