mirror of
https://github.com/chenasraf/nvim-treesitter.git
synced 2026-05-17 17:38:02 +00:00
feat(groq): add parser and queries (#8008)
This commit is contained in:
1
SUPPORTED_LANGUAGES.md
generated
1
SUPPORTED_LANGUAGES.md
generated
@@ -117,6 +117,7 @@ ecma (queries only)[^ecma] | unstable | `HFIJL` | | @steelsojka
|
||||
[graphql](https://github.com/bkegley/tree-sitter-graphql) | unstable | `H IJ ` | | @bkegley
|
||||
[gren](https://github.com/MaeBrooks/tree-sitter-gren) | unstable | `H J ` | | @MaeBrooks
|
||||
[groovy](https://github.com/murtaza64/tree-sitter-groovy) | unstable | `HFIJL` | | @murtaza64
|
||||
[groq](https://github.com/ajrussellaudio/tree-sitter-groq) | unstable | `HFIJ ` | | @ajrussellaudio
|
||||
[gstlaunch](https://github.com/tree-sitter-grammars/tree-sitter-gstlaunch) | unstable | `H ` | | @theHamsta
|
||||
[hack](https://github.com/slackhq/tree-sitter-hack) | unstable | `H J ` | |
|
||||
[hare](https://github.com/tree-sitter-grammars/tree-sitter-hare) | unstable | `HFIJL` | | @amaanq
|
||||
|
||||
@@ -857,6 +857,14 @@ return {
|
||||
maintainers = { '@murtaza64' },
|
||||
tier = 2,
|
||||
},
|
||||
groq = {
|
||||
install_info = {
|
||||
revision = '9959049ddeb4416101653a071ee923ba9f7a5cb1',
|
||||
url = 'https://github.com/ajrussellaudio/tree-sitter-groq',
|
||||
},
|
||||
maintainers = { '@ajrussellaudio' },
|
||||
tier = 2,
|
||||
},
|
||||
gstlaunch = {
|
||||
install_info = {
|
||||
revision = '549aef253fd38a53995cda1bf55c501174372bf7',
|
||||
|
||||
@@ -48,6 +48,17 @@
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children))
|
||||
|
||||
; Sanity CMS GROQ query
|
||||
; defineQuery(`...`)
|
||||
(call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "defineQuery")
|
||||
arguments: (arguments
|
||||
(template_string) @injection.content)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "groq"))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @_name
|
||||
(#eq? @_name "gql")
|
||||
|
||||
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"))
|
||||
Reference in New Issue
Block a user