Skip to content

Conversation

@ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 13, 2025

Do not apply the standardized file normalization to the source file itself. Otherwise we would get the following behavior:

  • We have a build system that uses standardized file paths and index a file as /tmp/test.c
  • We are asking for the main files of /private/tmp/test.c
  • Since indexstore-db uses realpath for everything, we find the unit for /tmp/test.c as a unit containing /private/tmp/test.c, which has /private/tmp/test.c as the main file.
  • If we applied the path normalization, we would normalize /private/tmp/test.c to /tmp/test.c, thus reporting that /tmp/test.c is a main file containing /private/tmp/test.c, But that doesn't make sense (it would, in fact cause us to treat /private/tmp/test.c as a header file that we should index using /tmp/test.c as a main file.

…he file itself

Do not apply the standardized file normalization to the source file itself. Otherwise we would get the following behavior:
 - We have a build system that uses standardized file paths and index a file as /tmp/test.c
 - We are asking for the main files of /private/tmp/test.c
 - Since indexstore-db uses realpath for everything, we find the unit for /tmp/test.c as a unit containing /private/tmp/test.c, which has /private/tmp/test.c as the main file.
 - If we applied the path normalization, we would normalize /private/tmp/test.c to /tmp/test.c, thus reporting that /tmp/test.c is a main file containing /private/tmp/test.c,
But that doesn't make sense (it would, in fact cause us to treat /private/tmp/test.c as a header file that we should index using /tmp/test.c as a main file.
@ahoppen
Copy link
Member Author

ahoppen commented Mar 13, 2025

@swift-ci Please test

@ahoppen ahoppen merged commit 23780ca into swiftlang:main Mar 14, 2025
3 checks passed
@ahoppen ahoppen deleted the normalized-path branch March 14, 2025 22:10
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Mar 14, 2025
@ahoppen ahoppen mentioned this pull request Mar 14, 2025
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