/ go Public
x/tools/gopls: add gopls.package_symbols command #51492
Issues related to the Go language server, gopls.
This label describes issues relating to any tools in the x/tools repository.
What did you do?
I'm developing a vim/neovim plugin that need to retrieve the all the tests of the current package. I would also want to list all the methods of the struct under the cursor.
What work around did you consider?
I tried using
DocumentSymbolsquery to retrieve all the symbols in the current package, then I filter it down. But this doesn't cover methods or tests defined in another file of the same package.
I also tried using the
WorkspaceSymbolsquery and use the package name as prefix, but the package name is not the full import, so the symbols returned could be from another package. E.g. I have a
github.com/jackieli-tes/errors.Isand if I filter workspace symbols by
^errors.Isit returns the std's
What solution do you want to see?
If #37237 is implemented. I believe all of the above problem should be solved.
Alternatively, most of the queries I'd like to have are all package related. So I propose adding and lsp command:
Query the package symbols of the package a given go file belongs to.
Querycan be an exact match or the same as the
WorkspaceSymbolsquery syntax: https://github.com/golang/tools/blob/master/gopls/doc/features.md#symbol-queries
Result should be same as WorkspaceSymbol
Editor and settings
I'm using neovim 0.6.1 with coc.nvim. Using the default instruction from editor section
The text was updated successfully, but these errors were encountered: