aboutsummaryrefslogtreecommitdiffstats
path: root/queries/promql
diff options
context:
space:
mode:
authorMichael Hoffmann <mhoffm@posteo.de>2023-07-08 19:44:16 +0200
committerAmaan Qureshi <amaanq12@gmail.com>2023-07-18 03:03:11 -0400
commitb64ea2ec444c27efd8d3bd2377a8b24589954363 (patch)
tree913151ad61c701e387da3d673464e45c03c4b71d /queries/promql
parentfix(menhir): adapt to scanner rewrite (diff)
downloadnvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar.gz
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar.bz2
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar.lz
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar.xz
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.tar.zst
nvim-treesitter-b64ea2ec444c27efd8d3bd2377a8b24589954363.zip
feat(promql,yaml): add parser and yaml injections
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
Diffstat (limited to 'queries/promql')
-rw-r--r--queries/promql/highlights.scm54
-rw-r--r--queries/promql/injections.scm1
2 files changed, 55 insertions, 0 deletions
diff --git a/queries/promql/highlights.scm b/queries/promql/highlights.scm
new file mode 100644
index 000000000..7c0d1241e
--- /dev/null
+++ b/queries/promql/highlights.scm
@@ -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
+
diff --git a/queries/promql/injections.scm b/queries/promql/injections.scm
new file mode 100644
index 000000000..ffdf4f8e6
--- /dev/null
+++ b/queries/promql/injections.scm
@@ -0,0 +1 @@
+((label_value) @regex (#offset! @regex 0 1 0 -1))