Skip to content

[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

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

johnfairh
Copy link
Contributor

This PR allows Xcode etc. to syntax-highlight #error/#warning like #if, & like #error in C, instead of like regular language keywords.

Before (now):
current

After (with Xcode change...):
proposed

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.

@harlanhaskins
Copy link
Contributor

Thank you for this!

@harlanhaskins
Copy link
Contributor

@swift-ci please smoke test

@harlanhaskins
Copy link
Contributor

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.

@johnfairh
Copy link
Contributor Author

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?

@harlanhaskins
Copy link
Contributor

I think @nkcsgexi knows more about this?

@nkcsgexi
Copy link
Contributor

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

@nkcsgexi
Copy link
Contributor

it seems CI has the issue in the first place. Let's try a clean build. @swift-ci Please clean smoke test

@nkcsgexi
Copy link
Contributor

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. 🙃

Copy link
Contributor

@nkcsgexi nkcsgexi left a 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.

@nkcsgexi nkcsgexi merged commit 677491f into swiftlang:master Feb 21, 2018
@johnfairh
Copy link
Contributor Author

Thanks! @nkcsgexi can you take care of opening an internal ticket/whatever so Xcode picks this up?

@johnfairh johnfairh deleted the pound-keywords branch February 22, 2018 12:57
@nkcsgexi
Copy link
Contributor

@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 😄

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.

3 participants