Ensure all dependencies in a multi-root project are cached #641
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.
I've had issues with a multi-root project where CPU runs through the roof every time https://github.com/felixfbecker/vscode-php-intellisense is opened.
The reason for this was LanguageServer.php was arbitrarily choosing the first composer.lock that it came across within rootPath, then indexing and caching dependencies from it alone. Consequently, whenever VSCode restarts, php-language-server re-indexes all of the vendor packages in sub-folders that weren't associated with the selected composer.json/lock file.
My quick patch here simply iterates over all composer.lock files within the multi-root project, indexes then caches to disk every single dependency it uncovers. The result of this being that subsequent startup times are much faster and CPU no longer tanks.
This is my simple solution which I believe partially solves what #509 is attempting to address. Possibly related to #465