Don't follow recursive symlinks during project discovery #1270
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.
Project discovery is done by crawling the workspace with
fast-glob
looking for CSS files, JS/TS config files, Sass/Less files, etc…A major problem with this approach though is that
fast-glob
crawls the filesystem and traverses into symlinked directories. If the symlink points back to a parent folder the crawler may cause a handful of issues:I've rewritten the traversal to use
fdir
+picomatch
which appears to avoid all of these issues. The implementation is fairly simple with the exception of some necessary tweaks to how we interpret theexcludes
setting from VSCode (basically just needed to create some new patterns from the old ones to match directories and files better).I've also implemented a timeout that will cause fdir to cancel the project search if it takes too long (this is currently hardcoded to 15s).
All existing tests pass as well as an additional test that previously timed out due to the use of recursive symlinks. This PR is going to require extensive testing on Windows with network shares, mapped drives, etc…
Fixes #1056
Fixes #1185