Code Search
The Code Search component hosts the codesearch webview.
Codesearch is similar to livegrep in that is supports regular expression based fast searching of a code repository (aka "index").
In this case, the "index" (corpus of files to be searched) is determined by a bazel query.
For example, imagine you needed to find all usages of
https://pkg.go.dev/syscall#Flock within your go_binary
named //corp_app
.
This is probably straightforward for "first-party" references; for this you
could just search the repository itself. However, "third-party" code (external
dependencies) would be excluded from this search.
This codesearch feature allows you to define a search space of
deps(//corp_app)
, thereby allowing you to find all .Flock
code references
for the app.
Configuration
Use the settings tree item to customize the default search settings.
Usage
Click on a codesearch codelens action link to open the codesearch webview:
To (re)create the search index, click the [Recreate Index] button:
Then start typing in the query input. Click on a line or highlighted search hit to navigate to the file.