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
[SR-6964] Syntax highlighting for #warning and #error #49512
Comments
What does |
Ah right, |
@akyrtzi, thoughts? |
Making it brownish will match how Xcode shows #error/#warning in C-family languages, but I'd recommend to classify those separately (maybe 'pound.diagnostic'), and leave it to the client to decide how to color. Even though that means Xcode will need an update to color it properly. |
Or 'builddirective.keyword' to include |
Nitpick: "builddirective" isn't a good name. The "build" in "buildconfig" refers to "checking the configuration of the thing we're building". (We also ditched that name in Swift 3 because Xcode has its own feature called "build configurations", but SourceKit requests are supposed to be stable-ish.) |
How about 'pound.keyword' ? |
OK! |
Working through that I went with 'poundstmt.keyword' because 'pound.keyword' felt too close to "keywords that begin with pound" (including #line eg.) which is not meant here. |
Hm. It's not a statement, though. (I may be being too nitpicky but "statements" can appear in certain places in the grammar.) Maybe going back to "directive"? |
It is tricky - maybe try to read as 'pound keyword that introduces a statement'? (The grammar calls these things 'compiler control statements' – I appreciate that refers to the pound-keyword and its arguments – as a production under 'statement'.) |
That grammar is incorrect. They're much closer to declarations, especially in Swift 4.1 and later. But even then they can appear where neither a statement nor a declaration can appear. |
(I admit that appealing to "the grammar in my head" or "the grammar defined by the current implementation of the parser" is not a great argument. But I'd rather not encode a misleading name forever.) |
No it's a good note, thanks, I'm sure the documented grammar will catch up with reality. So, catching up with a previous comment of yours now, I see 'directive' could work as a term that doesn't imply anything else. Will change to that unless further ideas. |
Supported by Xcode in beta 5. |
Attachment: Download
Additional Detail from JIRA
md5: 456efda40cce6bb8efb33fedcf9fdbfb
Issue Description:
Right now #error/#warning come out as pinkish (in default Xcode colors) rather than the brownish used for #if etc – see 'current' screenshot.
Is this intentional? Otherwise it might look better to classify them as
buildconfig.keyword
the same as #if etc, along the same lines as Xcode for ObjC & the Swift vim support – see 'proposed' screenshot.@harlanhaskins what do you think? I have a patch if you want it.
The text was updated successfully, but these errors were encountered: