feat(promql,yaml): add parser and yaml injections

Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
This commit is contained in:
Michael Hoffmann 2023-07-08 19:44:16 +02:00 committed by Amaan Qureshi
parent a2c3a7319f
commit b64ea2ec44
6 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,54 @@
; highlights.scm
[
"*"
"/"
"%"
"+"
"-"
">"
">="
"<"
"<="
"="
"=~"
"!="
"!~"
] @operator
[
"and"
"unless"
"or"
"bool"
] @keyword.operator
[
"{"
"}"
"["
"]"
"("
")"
] @punctuation.bracket
(float_literal) @float
(string_literal) @string
(metric_name) @type
(range_selection) @text.strong @type
(subquery_range_selection) @text.strong @type
(label_name) @field
(label_value) @text.underline @string.regex
(function_name) @function.call
[
"by"
"without"
] @function
(comment) @comment @spell
(ERROR) @error

View file

@ -0,0 +1 @@
((label_value) @regex (#offset! @regex 0 1 0 -1))

View file

@ -25,3 +25,29 @@
(block_sequence_item
(block_node
(block_scalar) @bash (#offset! @bash 0 1 0 0))))))
;; Prometheus Alertmanager ("expr")
(block_mapping_pair
key: (flow_node) @_expr (#eq? @_expr "expr")
value: (flow_node
(plain_scalar) @promql))
(block_mapping_pair
key: (flow_node) @_expr (#eq? @_expr "expr")
value: (block_node
(block_scalar) @promql (#offset! @promql 0 2 0 0)))
(block_mapping_pair
key: (flow_node) @_expr (#eq? @_expr "expr")
value: (block_node
(block_sequence
(block_sequence_item
(flow_node) @promql))))
(block_mapping_pair
key: (flow_node) @_expr (#eq @_expr "expr")
value: (block_node
(block_sequence
(block_sequence_item
(block_node
(block_scalar) @promql (#offset! @promql 0 2 0 0))))))