In VS Code's quick view you can type #mySymbol
to search your workspace for a symbol named mySymbol
. I'd like to get these symbol results programmatically but don't see a way via the API to do so. Any ideas?
You can run the vscode.executeWorkspaceSymbolProvider
command for this:
vscode.executeWorkspaceSymbolProvider
- Execute all workspace symbol provider.
- query - Search string
- (returns) - A promise that resolves to an array of SymbolInformation instances.
vscode.commands.executeCommand("vscode.executeWorkspaceSymbolProvider", "mySymbol").then(
function (symbols: vscode.SymbolInformation[]) {
// do something with the symbols
}
);
Note that some symbol provider implementations may not return any results if the search query is an empty string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With