Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Include the standard library in 'Go to Symbol in Workspace...' searching #1567

Closed
seen opened this issue Mar 8, 2018 · 9 comments · Fixed by #1604
Closed

Include the standard library in 'Go to Symbol in Workspace...' searching #1567

seen opened this issue Mar 8, 2018 · 9 comments · Fixed by #1604

Comments

@seen
Copy link

seen commented Mar 8, 2018

It would be nice if symbols from the stdlib were included when using 'Go to Symbol in Workspace...'.

It appears that go-symbols only accepts one root and making multiple invocations might bet messy, so an alternative approach of having a 'Go to Symbol in Standard Library...' could be sufficient

@ramya-rao-a
Copy link
Contributor

We would definitely not be overloading the existing Go to Symbol in Workspace command as it is meant for the current workspace.

Can you elaborate on your scenario here? Do you search for a symbol that you know for sure is part of the std lib? When doing so, do you also know which package it belongs to? If so, then have you tried the Go: Browse Packages command?

@ramya-rao-a
Copy link
Contributor

Also, if you are looking at searching for all symbols in given package, #671 is tracking that feature request

@seen
Copy link
Author

seen commented Mar 19, 2018

The desired result is having the same functionality (namely a type-ahead search) that Go to Symbol in Workspace has, but targeted at the standard library.

The main use case is for those times when I'm fairly sure of the naming of a symbol, but less certain of it's package location. The current solution is to either start typing in code and hope code sense picks up what I'm after, or heading to google. Neither of which are as effective as the behavior Go to Symbol in Workspace presents

@ramya-rao-a
Copy link
Contributor

The main use case is for those times when I'm fairly sure of the naming of a symbol, but less certain of it's package location

Would you know the package name at this point?

@seen
Copy link
Author

seen commented Mar 19, 2018

...package location should have really been package name. In this scenario I wouldn't know the package in which the symbol lives, otherwise I'd be able to use the Browse Packages command

@ramya-rao-a
Copy link
Contributor

Doesnt this scenario also extend to when using symbols from non std lib?

@seen
Copy link
Author

seen commented Mar 19, 2018

It does, but with projects utilizing dep or other dependency management techniques that have a vendor directory, those symbols are in the workspaces, so Go to Symbol in Workspace is sufficient

@ramya-rao-a
Copy link
Contributor

Ok, in that case we can have setting which when enabled can include the results from the std lib when the Go to Symbol in Workspace command is run. We can run go-symbols twice once on the current workspace and the second time on the goroot and return the combined results.

PRs are welcome.

ramya-rao-a pushed a commit that referenced this issue Apr 5, 2018
…1604)

* When gotoSymbol.includeGoroot is set, also show symbols from GOROOT

Setting the option to true enables the user to include the standard
library located at GOROOT to be included in the results shown on
"Go To Symbol" - resolves #1567

* Add proper types to empty arrays

* Correctly lookup GOROOT by calling `go env`

* tests

* Move logic for retrieving symbols from goroot a level down
@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented May 4, 2018

Thanks to @m90, this feature is now available in the latest update to the Go extension (0.6.79)
Add "gotoSymbol.includeGoroot": true to your settings to include symbols from GOROOT in the workspace symbol search

@vscodebot vscodebot bot locked and limited conversation to collaborators May 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants