Skip to content

Overhaul workspace search for symbol references - #1917

Merged
Andy Jordan (andyleejordan) merged 6 commits into
PowerShell:mainfrom
SeeminglyScience:workspace-scan-overhaul
Sep 15, 2022
Merged

Andy Jordan (andyleejordan) merged 6 commits into
PowerShell:mainfrom
SeeminglyScience:workspace-scan-overhaul

Conversation

@SeeminglyScience

Copy link
Copy Markdown
Collaborator

PR Summary

Dependent on PowerShell/vscode-powershell#4170

Significantly reduce performance overhead of reference finding in large workspaces.

PR Context

This PR has the following changes:

  1. Adds a reference cache to every ScriptFile
  2. Workspace scan is performed only once on first request
  3. An LSP file system watcher provides updates for files not changed via Did*TextDocument notifications
  4. Adds a setting to only search "open documents" for references. This disables both the initial workspace scan and the file system watcher, relying only on Did*TextDocument notifications.

As a stress test I opened up my profile directory (which has ~3k script files in total in the Modules directory) and created a file with a function definition on every line. I then tabbed to a different file, and then tabbed back to the new file. Before the changes, the references code lens took ~10 seconds to populate and my CPU spiked to ~50% usage. After the changes, they populated instantly and CPU spiked to ~2% usage.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Symbols and References Issue-Enhancement A feature request (enhancement).

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants