-
Notifications
You must be signed in to change notification settings - Fork 234
Find reference code lens results should be cached #678
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
Comments
In terms of implementation, I can imagine us caching the AST of files (a table of filepaths => ASTs) pretty easily. But I see you've written command caching. Do you mean we should cache the commands once they're parsed (as AST subunits)? If so, would it make sense for us to do the full AST caching and then process that to create a command cache and make invalidation work backwards (so changing a file invalidates the associated AST, which in turn bubbles up to the command cache)? |
I was under the impression we were already caching the AST. I thought we stored them as If I'm wrong and we don't do that, then yes absolutely we should cache the AST asap. That'd be a huge performance difference especially around DSC. The way I picture it being implemented is as a lazy property on |
Assigning this to Rob who's going to investigate this next week |
Had a brief look at the code for AST manipulation here. Can't find any evidence that we're doing any caching at all. Very much looking forward to adding some! 😈 |
Ah it looks like files are cached using Workspace.cs. |
I'm going to fully flesh out what I mean here as it can be kind of confusing to visualize. Lets say you have three files. Script AGet-ChildItem
Invoke-MyCommand Script BGet-Process
Invoke-MyCommand2 Script Cfunction Invoke-MyCommand { }
function Invoke-MyCommand2 { } Now lets say you have Script C open. The way code lens current works is like this:
Here's how I propose that it works:
That way every AST is only searched once per change of that file specifically. Right now every AST is searched once for every function definition in the open file, every time that file is changed. |
Fixed by #1917 ? |
Right now the references code lens searches the AST of every file in the work space for references every document edit. This causes intellisense to crawl in workspaces with a lot of PowerShell files.
We should cache the commands each workspace file references until they are changed.
The text was updated successfully, but these errors were encountered: