chore(grammar): update cairo + queries (#12712)

This commit is contained in:
0xLucqs 2025-01-28 15:19:33 +01:00 committed by GitHub
parent 8d6efaf350
commit 6049f2035b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 1 deletions

View file

@ -2199,7 +2199,7 @@ language-servers = [ "cairo-language-server" ]
[[grammar]] [[grammar]]
name = "cairo" name = "cairo"
source = { git = "https://github.com/starkware-libs/tree-sitter-cairo", rev = "e3a0212261c125cb38248458cd856c0ffee2b398" } source = { git = "https://github.com/starkware-libs/tree-sitter-cairo", rev = "4c6a25680546761b80a710ead1dd34e76c203125" }
[[language]] [[language]]
name = "cpon" name = "cpon"

View file

@ -71,6 +71,8 @@
"<" "<"
">" ">"
] @punctuation.bracket) ] @punctuation.bracket)
(closure_parameters
"|" @punctuation.bracket)
; --- ; ---
; Variables ; Variables
@ -92,6 +94,8 @@
(parameter (parameter
pattern: (identifier) @variable.parameter) pattern: (identifier) @variable.parameter)
(closure_parameters
(identifier) @variable.parameter)
; ------- ; -------
; Keywords ; Keywords
; ------- ; -------

View file

@ -115,6 +115,16 @@
(#not-same-line? @expr-start @pattern-guard) (#not-same-line? @expr-start @pattern-guard)
) @indent ) @indent
; Align closure parameters if they span more than one line
(closure_parameters
"|"
.
(_) @anchor
(_) @expr-end
.
(#not-same-line? @anchor @expr-end)
) @align
(for_expression (for_expression
"in" @in "in" @in
. .

View file

@ -7,6 +7,7 @@
(type_item) (type_item)
(trait_item) (trait_item)
(impl_item) (impl_item)
(closure_expression)
(block) (block)
] @local.scope ] @local.scope
@ -20,6 +21,8 @@
(constrained_type_parameter (constrained_type_parameter
left: (type_identifier) @local.definition) left: (type_identifier) @local.definition)
(closure_parameters (identifier) @local.definition)
; References ; References
(identifier) @local.reference (identifier) @local.reference
(type_identifier) @local.reference (type_identifier) @local.reference

View file

@ -1,6 +1,9 @@
(function_item (function_item
body: (_) @function.inside) @function.around body: (_) @function.inside) @function.around
(closure_expression
body: (_) @function.inside) @function.around
(struct_item (struct_item
body: (_) @class.inside) @class.around body: (_) @class.inside) @class.around
@ -16,6 +19,9 @@
(parameters (parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around) ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
(closure_parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
(type_parameters (type_parameters
((_) @parameter.inside . ","? @parameter.around) @parameter.around) ((_) @parameter.inside . ","? @parameter.around) @parameter.around)