-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit] Add syntaxtype for #error/#warning syntax coloring #14742
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
Conversation
Thank you for this! |
@swift-ci please smoke test |
swift/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp:343:12: error: use of undeclared identifier 'KindPoundStmtKeyword'
return KindPoundStmtKeyword; Not sure why that symbol isn't showing up on Linux. |
d58254a
to
f398d8c
Compare
Repushed to change terminology per Jordan. @harlanhaskins yw; the gyb stuff is new to SourceKit since I last looked so I might have missed something, or there could be a missing dependency somewhere that is not regenerating the .def file? |
I think @nkcsgexi knows more about this? |
hmm, the .def file should be generated by the gyb file before we build anything related to sourcekit. Does this build error happen in CI too? @swift-ci please smoke test |
it seems CI has the issue in the first place. Let's try a clean build. @swift-ci Please clean smoke test |
I think I didn't set the gyb dependency properly so that the added UID won't trigger another generation of the .def file. I tried to fix it by #14770. 🙃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for simplifying the syntax model walk-around.
Thanks! @nkcsgexi can you take care of opening an internal ticket/whatever so Xcode picks this up? |
@johnfairh , I'm sure this will be eventually integrated into Xcode; and whether we have an internal ticket or not doesn't change the timeline 😄 |
This PR allows Xcode etc. to syntax-highlight
#error
/#warning
like#if
, & like#error
in C, instead of like regular language keywords.Before (now):

After (with Xcode change...):

From SR-6964. Per discussion there this introduces a new syntax type for these types of compiler control statement that includes
#sourceLocation
.If this still sounds like a good idea at all then it's probably only worth taking if the Xcode change will happen - otherwise
#error
etc. will get no coloring at all which looks worse.