mirror of https://github.com/helix-editor/helix
feat: correct Swift highlights (#12409)
- Adds injections for the `comment` language - Correct highlight of the `nil` value. Same highlight as `null` in javascript, java and others - Recognize `<` and `>` as punctuation, used in generics (same color as the syntax used in other languages) - `protocol` function methods are recognized - When accessing object properties, like `hello.world`, the `world` is properly recognized as being a member - Recognize the `\` as an operatorpull/12416/head
parent
eed052e86b
commit
2b8f8df1af
|
@ -4,7 +4,7 @@
|
||||||
["\\(" ")"] @punctuation.special)
|
["\\(" ")"] @punctuation.special)
|
||||||
|
|
||||||
["." ";" ":" "," ] @punctuation.delimiter
|
["." ";" ":" "," ] @punctuation.delimiter
|
||||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
["(" ")" "[" "]" "{" "}" "<" ">"] @punctuation.bracket
|
||||||
|
|
||||||
; Identifiers
|
; Identifiers
|
||||||
(attribute) @variable
|
(attribute) @variable
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
(function_declaration (simple_identifier) @function.method)
|
(function_declaration (simple_identifier) @function.method)
|
||||||
|
(protocol_function_declaration (simple_identifier) @function.method)
|
||||||
(init_declaration ["init" @constructor])
|
(init_declaration ["init" @constructor])
|
||||||
(deinit_declaration ["deinit" @constructor])
|
(deinit_declaration ["deinit" @constructor])
|
||||||
|
|
||||||
|
@ -91,6 +92,9 @@
|
||||||
(#match? @type "^[A-Z]"))
|
(#match? @type "^[A-Z]"))
|
||||||
(call_expression (simple_identifier) @keyword (#eq? @keyword "defer")) ; defer { ... }
|
(call_expression (simple_identifier) @keyword (#eq? @keyword "defer")) ; defer { ... }
|
||||||
|
|
||||||
|
(navigation_suffix
|
||||||
|
(simple_identifier) @variable.other.member)
|
||||||
|
|
||||||
(try_operator) @operator
|
(try_operator) @operator
|
||||||
(try_operator ["try" @keyword])
|
(try_operator ["try" @keyword])
|
||||||
|
|
||||||
|
@ -147,7 +151,7 @@
|
||||||
(integer_literal) @constant.numeric.integer
|
(integer_literal) @constant.numeric.integer
|
||||||
(real_literal) @constant.numeric.float
|
(real_literal) @constant.numeric.float
|
||||||
(boolean_literal) @constant.builtin.boolean
|
(boolean_literal) @constant.builtin.boolean
|
||||||
"nil" @variable.builtin
|
"nil" @constant.builtin
|
||||||
|
|
||||||
"?" @type
|
"?" @type
|
||||||
(type_annotation "!" @type)
|
(type_annotation "!" @type)
|
||||||
|
@ -160,6 +164,7 @@
|
||||||
"?"
|
"?"
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
|
"\\"
|
||||||
"*"
|
"*"
|
||||||
"/"
|
"/"
|
||||||
"%"
|
"%"
|
||||||
|
|
|
@ -4,3 +4,7 @@
|
||||||
|
|
||||||
((regex_literal) @injection.content
|
((regex_literal) @injection.content
|
||||||
(#set! injection.language "regex"))
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment")
|
||||||
|
(#set! injection.include-children))
|
||||||
|
|
Loading…
Reference in New Issue