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:
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:
Step 1: Replace GoDocumentSymbolProvider implementation with a modified gopls documentSymbol, by amending the list of imports, and leave all the code untouched until gopls implements all the code lenses and go.generate.tests natively (https://github.com/golang/go/issues/40514#issuecomment-667185835)
Step 2: Implement codelens and go.generate.tests from gopls natively and get rid of GoDocumentSymbolProvider.
Note: minimize conflicts with the outstanding TestAPI work.
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 thego.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.
[x] gopkgs: https://github.com/golang/vscode-go/issues/258
gopkgs -format '{{.Name}};{{.ImportPath}};{{.Dir}}'
gopls.list_known_packages
[x] go-outline: https://github.com/golang/vscode-go/issues/1020
GoDocumentSymbolProvider
implementation with a modified gopls documentSymbol, by amending the list of imports, and leave all the code untouched until gopls implements all the code lenses and go.generate.tests natively (https://github.com/golang/go/issues/40514#issuecomment-667185835)go.generate.tests
from gopls natively and get rid ofGoDocumentSymbolProvider
.[x] guru: https://github.com/golang/go/issues/40862
[ ] gomodifytags: https://github.com/golang/vscode-go/issues/2002
gomodifytags
.[ ] goplay
go.playground
command)[x] impl: https://github.com/golang/go/issues/37537
go.impl.cursor
command)gopls.list_known_interfaces
gopls.generate_interface_stubs
[ ] gotests: https://github.com/golang/vscode-go/issues/1594
gopls.generate_tests
go.generateTestsFlags
and env vars (GOTEST_TEMPLATE_DIR
,GOTEST_TEMPLATE
)isImportant
,replacedByGopls
info in the tools list