Before this fix, workspace.findFiles('**/${filename}'); is invoked by setDiags callback registered at workspace.onDidChangeTextDocument(({ document }) => setDiags(document)) in src/extension/index.ts. Meaning a whole workspace search is triggered for each keystroke in vscode. For large workspaces, this results in loads of rg.exe spawning and global system slowdown as observed in #472.
This PR is a simple fix implementing a caching system on top of existing code. Cache invalidation callback is registered for onDidCreateFiles, onDidRenameFiles, and onDidDeleteFiles.
This is awesome Bowen, thanks a lot for solving it. I'm loaded with other work but this one is having an impact so I was trying (and failing) to put some more time into it.
Fixes #472
Before this fix,
workspace.findFiles('**/${filename}');
is invoked bysetDiags
callback registered atworkspace.onDidChangeTextDocument(({ document }) => setDiags(document))
insrc/extension/index.ts
. Meaning a whole workspace search is triggered for each keystroke in vscode. For large workspaces, this results in loads of rg.exe spawning and global system slowdown as observed in #472.This PR is a simple fix implementing a caching system on top of existing code. Cache invalidation callback is registered for
onDidCreateFiles
,onDidRenameFiles
, andonDidDeleteFiles
.Before this change:
After this change: