-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting to only analyze open documents for references #4170
Add setting to only analyze open documents for references #4170
Conversation
@@ -102,6 +102,7 @@ export interface ISettings { | |||
cwd?: string; | |||
notebooks?: INotebooksSettings; | |||
enableReferencesCodeLens?: boolean; | |||
analyzeOpenDocumentsOnly?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw I picked this name specifically to match C#'s
It doesn't perfectly fit, but I think it's pretty accurate. Open to changing though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
analyzeOpenDocumentsOnly: | ||
configuration.get<boolean>("analyzeOpenDocumentsOnly", true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need a bit in package.json
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol sure do. My b, I'll commit that in a sec. Good catch!
Significantly reduce performance overhead of reference finding in large workspaces. * Dependent on PowerShell/vscode-powershell#4170 * Adds a reference cache to every ScriptFile * Workspace scan is performed only once on first request * An LSP file system watcher provides updates for files not changed via Did*TextDocument notifications * 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.
PR Summary
Dependent on PowerShell/PowerShellEditorServices#1917
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
x
between the square brackets.Please mark anything not applicable to this PR
NA
.WIP:
to the beginning of the title and remove the prefix when the PR is ready