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: reduce the number of 3rd party tools the extension requires #1652

Open
4 of 9 tasks
hyangah opened this issue Jul 28, 2021 · 2 comments
Open
4 of 9 tasks

tools: reduce the number of 3rd party tools the extension requires #1652

hyangah opened this issue Jul 28, 2021 · 2 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented Jul 28, 2021

VS Code Go uses gopls for most of the language features, but there are a few features that still require 3rd party tools. We propose to migrate those features to gopls, reduce dependency on third party tools further, and improve security, reliability, usability and maintainability of the plugin.

This is a uber-issue to keep track of the progress and track glue work. Contribution/help is welcome!

Recently @marwan-at-work replaced use of gopkgs for the go.import.add command with custom commands implemented inside gopls. See the followings as inspiration:

https://github.com/golang/vscode-go/blob/master/src/goToolsInformation.ts has the full list of tools that can be used by the plugin.

  • gopkgs: tools: replace use of 'gopkgs' with 'go list all'  #258

    • Function: implements go.browse.packages
    • gopkgs is used to retrieve all known packages and create a QuickPick list, from which the user can select a package to browse.
      • gopkgs -format '{{.Name}};{{.ImportPath}};{{.Dir}}'
    • Proposal: use gopls's gopls.list_known_packages
  • go-outline: tools: replace go-outline with gopls #1020

    • Function: implements GoDocumentSymbolProvider used by the followings
      • References codelens (used to place the codelens to each function) - this can be replaced with gopls's DocumentSymbol
      • go.generate.tests (used to find the current function name at cursor) - this can be replaced with gopls's DocummentSymbol
      • Run Test / Debug Test codelens (getTestFunctions, getBenchmarkFunctions, getCodeLensForPackage)
        • Codelenses for standard tests can be replaced with gopls
        • Handling 3rd-party test framework needs gopls’s document symbol + list of imports (go list)
      • Proposal:
      • Note: minimize conflicts with the outstanding TestAPI work.
  • guru: x/tools/gopls: add codelens to show number of references to each symbol go#40862

  • gomodifytags: tools: merge gomodifytags functionality into gopls and use gopls #2002

    • Function: modify tags on structs (go.add.tags, go.remove.tags commands)
    • Proposal:
      • Option 1: do nothing and keep using fatih’s gomodifytags.
      • Option 2: implement from gopls
        - check if there is any reusable code if gomodifytags is refactored and discuss with fatih if so
  • goplay

    • Function: publish the code in the current editor to the Go playground (go.playground command)
    • Proposal: implement from the extension or gopls. We can also consider adding the playground’s new go.mod file support.
  • impl: x/tools/gopls: generate method stubs for a given interface go#37537

  • gotests: tools: migrate test generation features to gopls #1594

    • Function: Generate unit tests (go.test.generate.package, go.test.generate.file, go.test.generate.function commands)
    • Proposal:
      • Implement from gopls (note: gopls can import the gotests package)
      • gopls.generate_tests
        • Input: package directory, optional function name, …
        • Output: text edit
    • Note: make sure to handle go.generateTestsFlags and env vars (GOTEST_TEMPLATE_DIR, GOTEST_TEMPLATE)

  • Refactor/standardize the logic that determines whether gopls is active and gopls implements the feature.
  • Update isImportant, replacedByGopls info in the tools list
@gopherbot gopherbot added this to the Untriaged milestone Jul 28, 2021
@hyangah hyangah modified the milestones: Untriaged, Backlog Jul 28, 2021
@hyangah hyangah modified the milestones: Unplanned, On Deck Feb 15, 2022
scrosland added a commit to scrosland/dotfiles that referenced this issue Feb 28, 2022
mac/install/golang.sh: Add in gopkgs and go-outline which the vscode
plugin for go uses. There is work underway to replace some of these
with gopls, see golang/vscode-go#1652.
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/538762 mentions this issue: src/goToolsInformation: delete legacy tools

gopherbot pushed a commit that referenced this issue Nov 6, 2023
Fixes #2799
For #1652

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

hyangah commented Sep 11, 2024

cc @h9jiang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants