Add short-lived cache for documents and filter by language in linkifier. #2211
+34
−9
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.
Fix: Optimize inline code symbol linkifier to avoid redundant file I/O
The inline code linkifier (InlineCodeSymbolLinkifier) was causing severe performance issues during LLM response streaming. For each backticked symbol (e.g., TextDocument), it would re-read every reference file from disk, resulting in O(N×M) file reads where N = symbol count and M = reference count.
Changes:
Language gating: Skip files entirely when tree-sitter doesn't support their language (.log, .md, .json, etc.) in symbolMatchesOnly mode—zero I/O for unsupported files.
Document cache: Add a per-resolver documentCache so each file is read at most once per response, reducing file reads from O(N×M) to O(M).
Impact: Responses with many backticked symbols and large context files (especially non-code files like logs) should no longer hang the UI. Should help with microsoft/vscode#275716