Open jackieli-tes opened 2 years ago
Interestingly, vscode-go wants a similar feature when replacing the go-outline
-based document symbol provider with gopls
document symbol provider. vscode-go currently uses a (not-accurate) heuristic that parses the package statement. (cc @suzmue) For vscode-go, it would be convenient if this information was provided together with what gopls.list_imports
provided.
Change https://go.dev/cl/403615 mentions this issue: [dev.boringcrypto] README.boringcrypto.md: add note about the demise of the branch
gopls version
go env
What did you do?
I'm developing a vim/neovim plugin that need to retrieve the package name of the current buffer. E.g. I'd like to show the current package name for the buffer in status line or I need to use the package name to filter symbols belongs to the current package using the package name as prefix
What work around did you consider?
I'm using
go list
at the moment as a work around. I see vim-go does the same.The command executed is just
go list -f {{.Name}} file.go
with thefile.go
's folder as cwd.What solution do you want to see?
I think this information should be provided as a LSP command. I propose:
Identifier:
gopls.package_info
Retrieve the package info for a given go file.
Args:
Result:
Editor and settings
I'm using neovim 0.6.1 with coc.nvim. Using the default instruction from gopls editor section