Repository navigation
Added maxResults argument to provideWorkspaceSymbols - #193524
Sauvik Nath (Sauvikn98) wants to merge 4 commits into
Conversation
|
@microsoft-github-policy-service agree company="S&S Inc" |
|
👎 for an API change and hardcoded numbers.
Matt Bierner (@mjbvz) I don't know if that's true and iff why it was done. Such a low number seems extremely conservative, completions happily return 10000+ items and I think we should expect that symbol search can handle equally large numbers |
|
Johannes Rieken (@jrieken) Yes this is a real problem (the PR is a copy paste of what I wrote in the linked issue) Transmission may be fast enough but generating a list of every possible symbol in a TS proj is expensive, especially on large projects or when node modules are included. Even after optimizing it was still not fast enough So instead we decided to be pragmatic and optimize for how workspace symbols are shown to users. So far users have not complained about only seeing 256 at a time. You can keep typing to get more results. We only return 256 items max but always search the entire set of symbols |
|
Closing per above discussion. |
With Reference to Issue #191725
JS/TS's workspace symbol provider currently limits the number of workspace symbols it returns to 256. This is done for performance reasons. In large repos, it is costly to collect and transmit tens of thousands of workspace symbols, especially when you consider that users typically only look at the first 10 or so
However there are cases where you really do want every single workspace symbol in a workspace, for example when an extension uses the
vscode.executeWorkspaceSymbolProvidercommand. Today there is no way for an extension to get all JS/TS symbols as the VS Code api dose not provide a way to override TS Server's limit of 256 symbols per responseProposal
Add a new
maxResultsargument toprovideWorkspaceSymbols. This would have two benefits:In the normal go to symbol in workspace flow, we could set
maxResults = 500or some other number. This would let extensions that observe this new argument improve their performance by not collecting and transmitting tons and tons of symbolsWith the
vscode.executeWorkspaceSymbolProvidercommand or other cases where something else besides VS Code is calling intoprovideWorkspaceSymbols,we provide a mechanism to explicitly request every single workspace symbol instead of leaving it up to language servers to determine how many symbols they should return for good performance