-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(swift) improvements: support some
, @main
; Fix #
keywords .
#2845
Conversation
1. [`some` keyword][1] (Introduced in Swift 5.1) 2. [`@main` attribute][2] (Introduced in Swift 5.3) These language syntax features are utilized heavily in code that depends on the `SwiftUI` framework for user interfaces. [1]: https://github.com/apple/swift-evolution/blob/main/proposals/0244-opaque-result-types.md [2]: https://github.com/apple/swift-evolution/blob/main/proposals/0281-main-attribute.md
The default of lexeme pattern of `/\w+/` is not sufficient to capture keywords that start with a number sign character (like `#if` as one example). This updates the pattern to also recognize the number sign character as well as other alphanumeric characters that were previously recognized. [1] [1]: https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413
some
, @main
. fix #
keywords
@svanimpe Could you take a quick look here. Does this look good to you? I think the changes look good, I just don't know the language itself. Do you know anything about |
some
, @main
. fix #
keywords some
, @main
; Fix #
keywords .
I wonder if @mattt would be willing to help out here. Perhaps https://github.com/SwiftDocOrg/swift-doc can be used to generate a list of global functions in the Standard Library? |
There are a number of Swift issues open right now (many of them of the more trivial variety) if a Swift champion were to show up on the scene. :) #2825 |
I do worry that what we have now is perhaps someones list of "frequently used" rather than ever having been "all globals" (I really have no idea though), but now I'm curious. Swift is shipped as part of the |
If we're going to totally rewrite the keywords section overall I'd save that for another PR though and also switch to the new one keyword per line array style to make future maintenance easier. |
I don't, but that is really interesting/surprising—I'm honestly not aware of |
@natecook1000 You added |
Since we don't have any immediate answer on Thanks for the contribution! |
W.r.t. the built-ins: I've noticed that methods like |
Well if the language has changed then count be perhaps removed but ultimately this will be solved when the Swift grammar adds property access and method dispatch since that rule matching would win prevent the keyword from matching, etc. |
General enhancements and a bug fix for highlighting Swift code.
Changes
Adds highlighting support for new Swift 5.1 and 5.3 features that are heavily utilized in SwiftUI code:
some
keyword (Introduced in Swift 5.1)@main
attribute (Introduced in Swift 5.3)Fixes a bug where keywords that start with the
#
character (like#endif
as an example) are not matched.Checklist
CHANGES.md
AUTHORS.txt
, under Contributors