update to newest rescript treesitter library and queries (#11165)

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Co-authored-by: Freddie Ridell <freddie@Gilbraith-MacBook-Pro.local>
This commit is contained in:
Freddie Gilbraith 2024-11-20 22:08:38 +00:00 committed by GitHub
parent 4e2faa0be9
commit 07968880e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 50 additions and 24 deletions

View File

@ -1825,7 +1825,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]] [[grammar]]
name = "rescript" name = "rescript"
source = { git = "https://github.com/jaredramirez/tree-sitter-rescript", rev = "467dcf99f68c47823d7b378779a6b282d7ef9782" } source = { git = "https://github.com/rescript-lang/tree-sitter-rescript", rev = "5e2a44a9d886b0a509f5bfd0437d33b4871fbac5" }
[[language]] [[language]]
name = "erlang" name = "erlang"

View File

@ -10,11 +10,10 @@
[ [
(type_identifier) (type_identifier)
(unit_type) (unit_type)
(list)
(list_pattern)
] @type ] @type
(list ["list{" "}"] @type)
(list_pattern ["list{" "}"] @type)
[ [
(variant_identifier) (variant_identifier)
(polyvar_identifier) (polyvar_identifier)
@ -72,14 +71,16 @@
; single parameter with no parens ; single parameter with no parens
(function parameter: (value_identifier) @variable.parameter) (function parameter: (value_identifier) @variable.parameter)
; first-level descructuring (required for nvim-tree-sitter as it only matches direct
; children and the above patterns do not match destructuring patterns in NeoVim)
(parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter)))
(parameter (array_pattern (value_identifier) @variable.parameter))
(parameter (record_pattern (value_identifier) @variable.parameter))
; Meta ; Meta
;----- ;-----
[ (decorator_identifier) @keyword.directive
"@"
"@@"
(decorator_identifier)
] @keyword.directive
(extension_identifier) @keyword (extension_identifier) @keyword
("%") @keyword ("%") @keyword
@ -87,7 +88,7 @@
; Misc ; Misc
;----- ;-----
; (subscript_expression index: (string) @attribute) (subscript_expression index: (string) @attribute)
(polyvar_type_pattern "#" @constant) (polyvar_type_pattern "#" @constant)
[ [
@ -101,18 +102,21 @@
"external" "external"
"let" "let"
"module" "module"
"mutable"
"private" "private"
"rec" "rec"
"type" "type"
"and" "and"
"assert" "assert"
"async"
"await" "await"
"with" "with"
"unpack" "lazy"
] @keyword.storage.type "constraint"
] @keyword
"mutable" @keyword.storage.modifier ((function "async" @keyword.storage))
(module_unpack "unpack" @keyword)
[ [
"if" "if"
@ -169,6 +173,7 @@
"->" "->"
"|>" "|>"
":>" ":>"
"+="
(uncurry) (uncurry)
] @operator ] @operator

View File

@ -1,8 +1,29 @@
((comment) @injection.content ((comment) @injection.content (#set! injection.language "comment"))
(#set! injection.language "comment"))
((raw_js) @injection.content ; %re
(#set! injection.language "javascript")) (extension_expression
(extension_identifier) @_name
(#eq? @_name "re")
(expression_statement (_) @injection.content (#set! injection.language "regex")))
; %raw
(extension_expression
(extension_identifier) @_name
(#eq? @_name "raw")
(expression_statement
(_ (_) @injection.content (#set! injection.language "javascript"))))
; %graphql
(extension_expression
(extension_identifier) @_name
(#eq? @_name "graphql")
(expression_statement
(_ (_) @injection.content (#set! injection.language "graphql"))))
; %relay
(extension_expression
(extension_identifier) @_name
(#eq? @_name "relay")
(expression_statement
(_ (_) @injection.content (#set! injection.language "graphql") )))
((raw_gql) @injection.content
(#set! injection.language "graphql"))

View File

@ -1,7 +1,7 @@
(switch_expression) @local.scope (switch_expression) @local.scope
(if_expression) @local.scope
; Definitions ; Definitions
;------------ ;------------
(type_declaration) @local.defintion (type_declaration) @local.definition
(let_binding) @local.defintion (let_binding) @local.definition
(module_declaration) @local.definition

View File

@ -1,7 +1,7 @@
; Classes (modules) ; Classes (modules)
;------------------ ;------------------
(module_declaration definition: ((_) @class.inside)) @class.around (module_binding definition: ((_) @class.inside)) @class.around
; Blocks ; Blocks
;------- ;-------