Skip to content

Commit

Permalink
Update tree-sitter queries to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
meain authored Nov 10, 2023
1 parent 8180681 commit 78235ce
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 18 deletions.
2 changes: 2 additions & 0 deletions queries/astro/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; inherits: html

29 changes: 19 additions & 10 deletions queries/c/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,32 @@
(enum_specifier
body: (_) @class.inner) @class.outer

; conditional
; conditionals
(if_statement
consequence: (_)? @conditional.inner
alternative: (_)? @conditional.inner
) @conditional.outer
consequence: (compound_statement . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
)) @conditional.outer

(if_statement
condition: (_) @conditional.inner)
alternative: (else_clause (compound_statement . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
))) @conditional.outer

(if_statement) @conditional.outer

; loops
(for_statement
(_)? @loop.inner) @loop.outer
(while_statement) @loop.outer
(while_statement
(_)? @loop.inner) @loop.outer
(do_statement
(_)? @loop.inner) @loop.outer
body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}"
)) @loop.outer

(for_statement) @loop.outer
(for_statement
body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}"
)) @loop.outer

(do_statement) @loop.outer
(do_statement
body: (compound_statement . "{" . (_) @loop.inner._start @loop.inner._end (_)? @loop.inner._end . "}"
)) @loop.outer

(compound_statement) @block.outer
(comment) @comment.outer
Expand Down
6 changes: 6 additions & 0 deletions queries/ecma/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
consequence: (statement_block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
)) @conditional.outer

(if_statement
alternative: (else_clause (statement_block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
))) @conditional.outer

(if_statement) @conditional.outer

(switch_statement
body: (_)? @conditional.inner) @conditional.outer

Expand Down
8 changes: 7 additions & 1 deletion queries/fish/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
(function_definition) @function.outer
;; assignment
(command
name: (word) @_command
argument: (word) @_varname @assignment.lhs @assignment.inner
argument: (_)* @assignment.rhs
(#not-lua-match? @_varname "[-].*")
(#eq? @_command "set")) @assignment.outer

(command
name: (word) @_name
Expand Down
13 changes: 6 additions & 7 deletions queries/rust/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,12 @@
. (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end)
)

;; Disabled as not available in upstream language grammar repo (will need rust lang update)
;; ((token_tree
;; "," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end)
;; )
;; ((token_tree
;; . (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end)
;; )
((token_tree
"," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end)
)
((token_tree
. (_) @parameter.inner @parameter.outer._start . ","? @parameter.outer._end)
)

(scoped_use_list
list: (use_list "," @parameter.outer._start . (_) @parameter.inner @parameter.outer._end
Expand Down

0 comments on commit 78235ce

Please sign in to comment.