Use paths relative to opened folder when searching for projects #1013
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.
In Intellisense we look through a workspace's folders to find JS/TS config files (v3) and CSS config files (v4). In v4 specifically, we must do import resolution and graphing to ensure we find the "root" CSS files in a project. Doing so correctly requires the use of a file's "real path" because we may encounter symlinks that point back to the same file.
However, we're currently using the real path in all paths we find when searching for files in a project. The problem is that files opened in VSCode are not matched against the real path but the path that was opened. For example, if you open a file through a symlink, all paths we see are generally relative to that symlink. Given that we're using the real path to a file this means matching files to a project can fail because, while the file may be tecnically the same, the path of the opened file does not match the real path of the project itself.
This can affect opening projects when:
C:\Users\sarahjane\Projects
points toE:\
)Z:
points to\\server\share\project
)Given this, it's best for us is to perform globs, file lookups, and pattern matching against paths relative to the opened file URIs. However, we still use real paths internally when doing CSS graph traversal so we can find the correct CSS files in a project. We also use these real paths to help eliminate symlinks when we're already considering the real path of a file.