feat(roc)!: bump parser and queries

Adapt to https://github.com/faldor20/tree-sitter-roc/pull/30

Also synchronize queries with upstream and add indents
This commit is contained in:
Christian Clason 2025-03-09 12:06:59 +01:00 committed by Christian Clason
parent f06adcf572
commit afe977dadd
5 changed files with 107 additions and 11 deletions

View file

@ -681,7 +681,7 @@
"revision": "8e3a4205b76236bb6dbebdbee5afc262ce38bb62" "revision": "8e3a4205b76236bb6dbebdbee5afc262ce38bb62"
}, },
"roc": { "roc": {
"revision": "de0839d6c7db2405e827435cf3ac62d22f4bd5e9" "revision": "54c9a725fc7a419ccec8ad1a7761631f857b553a"
}, },
"ron": { "ron": {
"revision": "78938553b93075e638035f624973083451b29055" "revision": "78938553b93075e638035f624973083451b29055"

View file

@ -32,6 +32,12 @@
(field_access_expr (field_access_expr
(identifier) @variable.member) (identifier) @variable.member)
;highlight module members as records instead of free variables
; avoids highlighting them as out-of-scope vars
(variable_expr
(module)
(identifier) @variable.member)
;----comments---- ;----comments----
(line_comment) @comment @spell (line_comment) @comment @spell
@ -41,8 +47,8 @@
[ [
"?" "?"
(arrow) (arrow)
(back_arrow) (fat_arrow)
(backslash) "|"
"," ","
":" ":"
] @punctuation.delimiter ] @punctuation.delimiter
@ -59,6 +65,8 @@
[ [
"|" "|"
"&" "&"
"<-"
".."
(operator) (operator)
] @operator ] @operator
@ -92,10 +100,6 @@
"imports" "imports"
] @keyword.import ] @keyword.import
(backpassing_expr
assignee: (identifier_pattern
(identifier) @variable.parameter))
(value_declaration (value_declaration
(decl_left (decl_left
(identifier_pattern (identifier_pattern
@ -105,8 +109,7 @@
;----tags---- ;----tags----
(tags_type (tags_type
(apply_type (tag_type) @constructor)
(concrete_type) @constructor))
[ [
(tag) (tag)
@ -123,11 +126,11 @@
"dbg" @keyword.debug "dbg" @keyword.debug
;----function invocations ---- ;----function invocations ----
(function_call_expr (function_call_pnc_expr
caller: (variable_expr caller: (variable_expr
(identifier) @function.call)) (identifier) @function.call))
(function_call_expr (function_call_pnc_expr
caller: (field_access_expr caller: (field_access_expr
(identifier) @function.call .)) (identifier) @function.call .))

60
queries/roc/indents.scm Normal file
View file

@ -0,0 +1,60 @@
; (value_declaration(expr_body(anon_fun_expr)))@indent.ignore
[
(when_is_expr)
(when_is_branch)
(record_expr)
(anon_fun_expr)
(list_expr)
(parenthesized_expr)
(function_call_pnc_expr)
(tuple_expr)
(imports)
(exposes)
(exposes_list)
(exposing)
;patterns
(record_pattern)
(tuple_pattern)
(list_pattern)
;ability stuff
(ability_implementation)
(opaque_type_def)
;types
(record_type)
(tags_type)
(record_expr)
(implements_implementation)
"{"
"("
"["
] @indent.begin
; ((record_type)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((record_expr)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((tags_type) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
; ((implements_implementation) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
(expr_body) @indent.begin
(ERROR
"=") @indent.begin
(then) @indent.begin
(else) @indent.begin
[
; result:(_)
"]"
"}"
")"
] @indent.branch

View file

@ -1,3 +1,28 @@
;injection from function calls
(function_call_pnc_expr
(variable_expr
(identifier) @injection.language)
(const
[
(multiline_string)
(string)
] @injection.content)
(#any-eq? @injection.language
"json" "toml" "yaml" "xml" "sql" "lua" "js" "html" "css" "http" "jq" "latex" "md" "nix" "regex"))
;injection from piping function calls
(bin_op_expr
part: (const
[
(multiline_string)
(string)
] @injection.content)
part: (operator)
part: (variable_expr
(identifier) @injection.language)
(#any-eq? @injection.language
"json" "toml" "yaml" "xml" "sql" "lua" "js" "html" "css" "http" "jq" "latex" "md" "nix" "regex"))
([ ([
(line_comment) (line_comment)
(doc_comment) (doc_comment)

View file

@ -35,6 +35,14 @@
(identifier_pattern (identifier_pattern
(identifier) @local.definition) (identifier) @local.definition)
(when_is_branch
pattern: (_
(identifier_pattern
(identifier) @local.definition)))
(spread_pattern
(identifier) @local.definition)
(identifier) @local.reference (identifier) @local.reference
(tag_expr (tag_expr