feat(gotmpl,helm): raise highlight priorities (#6712)

This commit is contained in:
Kai Moschcau 2024-07-03 09:59:18 +02:00 committed by GitHub
parent 0209151fd2
commit f1a4a75005
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 21 deletions

View file

@ -1,39 +1,49 @@
; Priorities of the highlight queries are raised, so that they overrule the
; often surrounding and overlapping highlights from the non-gotmpl injections.
;
; Identifiers
[
([
(field)
(field_identifier)
] @variable.member
(#set! priority 110))
(variable) @variable
((variable) @variable
(#set! priority 110))
; Function calls
(function_call
function: (identifier) @function)
function: (identifier) @function
(#set! priority 110))
(method_call
method: (selector_expression
field: (field_identifier) @function))
field: (field_identifier) @function
(#set! priority 110)))
; Builtin functions
(function_call
function: (identifier) @function.builtin
(#set! priority 110)
(#any-of? @function.builtin
"and" "call" "html" "index" "slice" "js" "len" "not" "or" "print" "printf" "println" "urlquery"
"eq" "ne" "lt" "ge" "gt" "ge"))
; Operators
[
([
"|"
":="
] @operator
(#set! priority 110))
; Delimiters
[
([
"."
","
] @punctuation.delimiter
(#set! priority 110))
[
([
"{{"
"}}"
"{{-"
@ -41,6 +51,7 @@
")"
"("
] @punctuation.bracket
(#set! priority 110))
; Actions
(if_action
@ -49,59 +60,73 @@
"else"
"else if"
"end"
] @keyword.conditional)
] @keyword.conditional
(#set! priority 110))
(range_action
[
"range"
"else"
"end"
] @keyword.repeat)
] @keyword.repeat
(#set! priority 110))
(template_action
"template" @function.builtin)
"template" @function.builtin
(#set! priority 110))
(block_action
[
"block"
"end"
] @keyword.directive)
] @keyword.directive
(#set! priority 110))
(define_action
[
"define"
"end"
] @keyword.directive.define)
] @keyword.directive.define
(#set! priority 110))
(with_action
[
"with"
"else"
"end"
] @keyword.conditional)
] @keyword.conditional
(#set! priority 110))
; Literals
[
([
(interpreted_string_literal)
(raw_string_literal)
] @string
(#set! priority 110))
(rune_literal) @string.special.symbol
((rune_literal) @string.special.symbol
(#set! priority 110))
(escape_sequence) @string.escape
((escape_sequence) @string.escape
(#set! priority 110))
[
([
(int_literal)
(imaginary_literal)
] @number
(#set! priority 110))
(float_literal) @number.float
((float_literal) @number.float
(#set! priority 110))
[
([
(true)
(false)
] @boolean
(#set! priority 110))
(nil) @constant.builtin
((nil) @constant.builtin
(#set! priority 110))
(comment) @comment @spell
((comment) @comment @spell
(#set! priority 110))

View file

@ -1,8 +1,11 @@
; inherits: gotmpl
; For the reasoning concerning the priorities, see gotmpl highlights.
;
; Builtin functions
(function_call
function: (identifier) @function.builtin
(#set! priority 110)
(#any-of? @function.builtin
"and" "or" "not" "eq" "ne" "lt" "le" "gt" "ge" "default" "required" "empty" "fail" "coalesce"
"ternary" "print" "println" "printf" "trim" "trimAll" "trimPrefix" "trimSuffix" "lower" "upper"
@ -33,6 +36,7 @@
(selector_expression
operand: (field
name: (identifier) @constant.builtin
(#set! priority 110)
(#any-of? @constant.builtin
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
(field_identifier))
@ -41,5 +45,6 @@
(selector_expression
operand: (variable)
field: (field_identifier) @constant.builtin
(#set! priority 110)
(#any-of? @constant.builtin
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))