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

tools: replace go-outline with gopls #1020

Closed
hyangah opened this issue Dec 10, 2020 · 14 comments
Closed

tools: replace go-outline with gopls #1020

hyangah opened this issue Dec 10, 2020 · 14 comments
Assignees
Labels
FrozenDueToAge gopls gopls related issues
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 10, 2020

go-outline is no longer used for outline view when language server is enabled.
However, it's still being used by GoDocumentSymbolProvider that is used for

  • generate tests: goGenerateTests.ts
  • references codelens: goReferencesCodelens.ts
  • run test/benchmark codelenses: goRuntestCodelens.ts

They can be replaced with gopls's implementation LanguageClient.getFeatures("textDocument/documentSymbol") or with a direct invocation of vscode.commands.executeCommand('vscode.executeDocumentSymbolProvider', ...).

One difference between the gopls's document symbol provider and GoDocumentSymbolProvider is gopls version doesn't provide the file's package name info, so we need a different way to find the package name if the info is necessary. See golang/go#40514.

@hyangah hyangah added the gopls gopls related issues label Dec 16, 2020
@hyangah hyangah added this to the Backlog milestone Dec 16, 2020
@qdm12
Copy link

qdm12 commented Jun 23, 2021

Any update on this one? Can we drop go-outline already if we use gopls today? Or is it still needed? Thanks!

@mihaitodor
Copy link

Would be great to see this one fixed. go-outline doesn't seem to be actively maintained and VS Code has a hard time installing it in some cases: ramya-rao-a/go-outline#15

@hyangah hyangah added the HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. label Sep 5, 2021
@findleyr findleyr self-assigned this Jan 7, 2022
@hyangah hyangah assigned suzmue and unassigned findleyr Feb 7, 2022
@hyangah hyangah modified the milestones: Unplanned, v0.32.0 Feb 8, 2022
@hyangah
Copy link
Contributor Author

hyangah commented Feb 8, 2022

Gopls issue golang/go#40514 was closed but instead of implementing a variation of documentSymbol, gopls implements gopls.list_imports command that provides the list of imported packages from the specified file and the package the file belongs to. So, the plan is to combine the usual symbol provider output and the gopls.list_imports output from the extension side.

cc @suzmue @heschi

@hyangah hyangah added release-blocker must be fixed before the next release. and removed HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. labels Feb 8, 2022
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/384574 mentions this issue: src/goOutline: use language server to get document symbols

gopherbot pushed a commit that referenced this issue Feb 14, 2022
This change replaces the use of go-outline with gopls when
available. This is done by fixing up the results from gopls
to resemble those returned by go-outline to avoid having to
handle these document symbols differently in various places.

Also sets the testing gopls version to pre release.

Updates #1020

Change-Id: Ib3ce4fe04c3ffe9428f6701ffaa24dd8444781c0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/384574
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/386218 mentions this issue: src/goOutline.ts: use regexp to find package decl

gopherbot pushed a commit that referenced this issue Feb 18, 2022
In order to get the correct location of the package declaration
we can use a regexp as a close heuristic.

Updates #1020

Change-Id: I12a6fe296cf72ec5a331d7e2b70a5050d0882e63
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/386218
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/387962 mentions this issue: src/goImport,goOutline: check registered gopls commands

gopherbot pushed a commit that referenced this issue Feb 25, 2022
This change makes goImport and goOutline to inspect
goLanguageServer's serverInfo and see if the necessary
commands are available in gopls. If not, fall back to
the legacy providers.

For #1020

Change-Id: I061be2bf5479273141968d80a63b1f1f3019e9c4
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/387962
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
@hyangah
Copy link
Contributor Author

hyangah commented Mar 1, 2022

@suzmue Are we ready to close this?

@suzmue
Copy link
Contributor

suzmue commented Mar 1, 2022

@hyangah I think we can close this. There is more work we can do to clean up the code when we remove the go-outline code path, but that can be a separate issue.

@suzmue suzmue closed this as completed Mar 1, 2022
@qdm12
Copy link

qdm12 commented Mar 2, 2022

Hello all, first thanks for your work.

Can we now expect gopls to fullfill the role of Go-outline?
Is there a particular vscode/go extension/gopls minimum release to match?

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/389716 mentions this issue: src/goTOolsInformation: mark go-outline as a tool replaced by gopls

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/389994 mentions this issue: src/goGenerateTests: fix method can not generate test in gopls document symbol

@suzmue
Copy link
Contributor

suzmue commented Mar 4, 2022

In the next release we will attempt to use gopls if available, but will still recommend installing go-outline as a fallback.

@suzmue suzmue reopened this Mar 4, 2022
@suzmue suzmue removed the release-blocker must be fixed before the next release. label Mar 4, 2022
gopherbot pushed a commit that referenced this issue Mar 4, 2022
…nt symbol

Gopls's document symbol provider classifies methods correctly, while `go-outline`-based document symbol provider marks them as "function". The difference caused regression after change for #1020.

Fixes #2091

Change-Id: I1b92753132be26b528f994ae42af32c723dd7ce2
GitHub-Last-Rev: 6483108
GitHub-Pull-Request: #2090
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/389994
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Suzy Mueller <suzmue@golang.org>
@hyangah hyangah modified the milestones: v0.32.0, v0.33.0 Mar 8, 2022
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/398155 mentions this issue: src/goMain: require configureLanguageServer for full activation

gopherbot pushed a commit that referenced this issue Apr 6, 2022
Providers and commands are not registered until language server
configuration is done.

For #1020
For #1878

Change-Id: I2f20dee6f2b4d73ff0adc841a540bb0cf9e99b7c
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/398155
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: Jamal Carvalho <jamal@golang.org>
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/400360 mentions this issue: src/goToolsInformation: mark go-outline as replacedByGopls

qdm12 added a commit to qdm12/godevcontainer that referenced this issue Apr 26, 2022
@golang golang locked and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls gopls related issues
Projects
None yet
Development

No branches or pull requests

6 participants