mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(groq): add parser and queries (#8008)
This commit is contained in:
parent
a5edb0a274
commit
61ec748ef7
7 changed files with 142 additions and 0 deletions
5
runtime/queries/groq/folds.scm
Normal file
5
runtime/queries/groq/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(object)
|
||||
(projection)
|
||||
(array)
|
||||
] @fold
|
||||
104
runtime/queries/groq/highlights.scm
Normal file
104
runtime/queries/groq/highlights.scm
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
; Keywords
|
||||
[
|
||||
"select"
|
||||
"asc"
|
||||
"desc"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"in"
|
||||
"match"
|
||||
] @keyword.operator
|
||||
|
||||
; Operators
|
||||
[
|
||||
"=="
|
||||
"!="
|
||||
">"
|
||||
">="
|
||||
"<"
|
||||
"<="
|
||||
"&&"
|
||||
"||"
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"**"
|
||||
".."
|
||||
"..."
|
||||
"=>"
|
||||
"->"
|
||||
"|"
|
||||
] @operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(number) @number
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
; Special references
|
||||
[
|
||||
(null)
|
||||
(star)
|
||||
(parent)
|
||||
(this)
|
||||
] @constant.builtin
|
||||
|
||||
; Identifiers
|
||||
(identifier) @variable
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
"$" @variable.parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Function calls
|
||||
(function_call
|
||||
(identifier) @function)
|
||||
|
||||
(order_function
|
||||
"order" @function.builtin)
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
|
||||
; String keys in projections/objects
|
||||
(pair
|
||||
(literal
|
||||
(string) @property))
|
||||
|
||||
; Highlight field names in projections
|
||||
(projection
|
||||
(identifier) @property)
|
||||
|
||||
; Built-in functions (essential GROQ functions)
|
||||
(function_call
|
||||
(identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"count" "length" "defined" "references" "now" "dateTime" "coalesce" "unique" "max" "min" "sum"
|
||||
"avg" "round" "floor" "ceil" "abs" "sqrt" "upper" "lower" "string" "number" "boolean" "array"
|
||||
"object" "type" "global" "sanity" "path" "delta" "after" "before"))
|
||||
11
runtime/queries/groq/indents.scm
Normal file
11
runtime/queries/groq/indents.scm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
(object)
|
||||
(projection)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
"}" @indent.end
|
||||
2
runtime/queries/groq/injections.scm
Normal file
2
runtime/queries/groq/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue