aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/prql
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/prql
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/prql')
-rw-r--r--runtime/queries/prql/highlights.scm135
-rw-r--r--runtime/queries/prql/injections.scm13
2 files changed, 148 insertions, 0 deletions
diff --git a/runtime/queries/prql/highlights.scm b/runtime/queries/prql/highlights.scm
new file mode 100644
index 000000000..d24777dc0
--- /dev/null
+++ b/runtime/queries/prql/highlights.scm
@@ -0,0 +1,135 @@
+[
+ (keyword_from)
+ (keyword_filter)
+ (keyword_derive)
+ (keyword_group)
+ (keyword_aggregate)
+ (keyword_sort)
+ (keyword_take)
+ (keyword_window)
+ (keyword_join)
+ (keyword_select)
+ (keyword_append)
+ (keyword_remove)
+ (keyword_intersect)
+ (keyword_rolling)
+ (keyword_rows)
+ (keyword_expanding)
+ (keyword_let)
+ (keyword_prql)
+ (keyword_from_text)
+] @keyword
+
+(keyword_loop) @keyword.repeat
+
+(keyword_case) @keyword.conditional
+
+[
+ (literal_string)
+ (f_string)
+ (s_string)
+] @string
+
+(assignment
+ alias: (field) @variable.member)
+
+alias: (identifier) @variable.member
+
+(comment) @comment @spell
+
+(function_call
+ (identifier) @function.call)
+
+[
+ "+"
+ "-"
+ "*"
+ "/"
+ "="
+ "=="
+ "<"
+ "<="
+ "!="
+ ">="
+ ">"
+ "&&"
+ "||"
+ "//"
+ "~="
+ (bang)
+] @operator
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ ","
+ "."
+ "->"
+] @punctuation.delimiter
+
+(integer) @number
+
+(decimal_number) @number.float
+
+[
+ (keyword_min)
+ (keyword_max)
+ (keyword_count)
+ (keyword_count_distinct)
+ (keyword_average)
+ (keyword_avg)
+ (keyword_sum)
+ (keyword_stddev)
+ (keyword_count)
+ (keyword_rank)
+] @function
+
+[
+ (keyword_side)
+ (keyword_format)
+] @attribute
+
+[
+ (keyword_version)
+ (keyword_target)
+] @keyword.modifier
+
+(target) @function.builtin
+
+[
+ (date)
+ (time)
+ (timestamp)
+] @string.special
+
+[
+ (keyword_left)
+ (keyword_inner)
+ (keyword_right)
+ (keyword_full)
+ (keyword_csv)
+ (keyword_json)
+] @function.method.call
+
+[
+ (keyword_true)
+ (keyword_false)
+] @boolean
+
+(function_definition
+ (keyword_let)
+ name: (identifier) @function)
+
+(parameter
+ (identifier) @variable.parameter)
+
+(variable
+ (keyword_let)
+ name: (identifier) @constant)
+
+(keyword_null) @constant.builtin
diff --git a/runtime/queries/prql/injections.scm b/runtime/queries/prql/injections.scm
new file mode 100644
index 000000000..e6cbeda35
--- /dev/null
+++ b/runtime/queries/prql/injections.scm
@@ -0,0 +1,13 @@
+((s_string) @injection.content
+ (#set! injection.language "sql")
+ (#offset! @injection.content 0 2 0 -1))
+
+(from_text
+ (keyword_from_text)
+ (keyword_json)
+ (literal) @injection.content
+ (#set! injection.language "json")
+ (#offset! @injection.content 0 3 0 -3))
+
+((comment) @injection.content
+ (#set! injection.language "comment"))