Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix location for diagnostics generated from macros via swiftc #1234

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented Nov 28, 2024

The format of messages generated from macro errors/warnings is different than those generated normally. The parsing regex would capture the location for the related info diagnostic with a backtick. The location for the parent regex would be "#macro expansion" which when clicked would open an error window in a VS Code tab stating that the file "#macro expansion" could not be found.

This patch tweaks two things:

  1. Makes the regex for capturing the filepaths of warnings/errors account for leading trivia
  2. If the path for a diagnostic is invalid, wait until we parse the related information and use the URI from there.

Issue #1224

The format of messages generated from macro errors/warnings is different
than those generated normally. The parsing regex would capture the
location for the related info diagnostic with a backtick. The location
for the parent regex would be "#macro expansion" which when clicked
would open an error window in a VS Code tab stating that the file
"#macro expansion" could not be found.

This patch tweaks two things:
1. Makes the regex for capturing the filepaths of warnings/errors
   account for leading trivia
2. If the path for a diagnostic is invalid, wait until we parse the
   related infromation and use the URI from there.
@plemarquand plemarquand force-pushed the diagnostics-from-macros branch 2 times, most recently from be8683b to 4fd1b11 Compare November 29, 2024 15:25
@plemarquand plemarquand force-pushed the diagnostics-from-macros branch from 4fd1b11 to 9ae189a Compare November 29, 2024 15:32
@plemarquand plemarquand merged commit 74b8233 into swiftlang:main Dec 2, 2024
15 checks passed
@plemarquand plemarquand deleted the diagnostics-from-macros branch December 2, 2024 13:28
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