microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.17k stars 12.38k forks source link

Workspace Symbol Provider called with empty string doesn't return all workspace symbols #37954

Open usernamehw opened 4 years ago

usernamehw commented 4 years ago

TypeScript Version: 3.8.3

Search Terms: Workspace Symbol Provider executeWorkspaceSymbolProvider

Running this code from vscode extension: Code

const allSymbols = await commands.executeCommand('vscode.executeWorkspaceSymbolProvider', '');
console.log(allSymbols);// []

Expected behavior:

All the symbols in workspace returned

Actual behavior:

An empty array returned


Workspace symbol provider says empty string should return all symbols.

/**
 * Project-wide search for a symbol matching the given query string.
 *
 * The `query`-parameter should be interpreted in a *relaxed way* as the editor will apply its own highlighting
 * and scoring on the results. A good rule of thumb is to match case-insensitive and to simply check that the
 * characters of *query* appear in their order in a candidate symbol. Don't use prefix, substring, or similar
 * strict matching.
 *
 * To improve performance implementors can implement `resolveWorkspaceSymbol` and then provide symbols with partial
 * [location](#SymbolInformation.location)-objects, without a `range` defined. The editor will then call
 * `resolveWorkspaceSymbol` for selected symbols only, e.g. when opening a workspace symbol.
 *
 * @param query A query string, can be the empty string in which case all symbols should be returned.
 * @param token A cancellation token.
 * @return An array of document highlights or a thenable that resolves to such. The lack of a result can be
 * signaled by returning `undefined`, `null`, or an empty array.
 */

Redirected from https://github.com/microsoft/vscode/issues/94770

qqaimh commented 2 months ago

python also has this problem