Skip to content

Conversation

thecrypticace
Copy link
Contributor

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:

  • It's opened via a symlink — can affect Windows, Linux, or macOS
  • On Windows, it's on a virtual disk that's mounted as a directory on another drive (e.g. C:\Users\sarahjane\Projects points to E:\)
  • On Windows, you've opened a file on a mapped network drive (e.g. 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.

@thecrypticace thecrypticace merged commit cc2bb07 into master Jul 5, 2024
@thecrypticace thecrypticace deleted the fix/aliased-paths branch July 5, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants