Fix performance regression in Goto Symbol overlay #2348
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... which was described in #2346.
This should make the LSP Goto Symbol overlay appear (almost) immediately again, even for very large files, by lazily calculating the character offsets from LSP row/col position (for highlighting and scrolling).
I tested with a file with 5000 symbols in it, where this saves 10k API calls.
By the way, it doesn't really make any sense that this could have been a cause for worse performance, because before the commit 2e06833 the same amount of API calls (for
SymbolInformation[]
response) were done as well (range_to_region
function), or even twice the amount (forDocumentSymbol[]
response). Perhaps the ListInputHandler is just slower thanwindow.show_quick_panel
, in combination with many recent API calls. Anyway, this seems to work and it looks like a useful improvement to me.