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 Dec 1, 2023
1 parent 9a9edd4 commit f440811
Show file tree
Hide file tree
Showing 8 changed files with 599 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
59 changes: 59 additions & 0 deletions queries/gdscript/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
(function_definition
body: (_) @function.inner) @function.outer

(constructor_definition
body: (_) @function.inner) @function.outer

(class_definition
body: (_) @class.inner) @class.outer

(if_statement
body: (_) @conditional.inner) @conditional.outer

(if_statement
alternative: (_ (_) @conditional.inner)?) @conditional.outer

(if_statement
condition: (_) @conditional.inner)

[
(for_statement)
(while_statement)
] @loop.outer

(while_statement body: (_) @loop.inner)

(for_statement body: (_) @loop.inner)

(comment) @comment.outer

(parameters
"," @parameter.outer._start .
(_) @parameter.inner @parameter.outer._end
)

(parameters
. (_) @parameter.inner @parameter.outer._start
. ","? @parameter.outer._end
)

(arguments
"," @parameter.outer._start .
(_) @parameter.inner @parameter.outer._end
)

(arguments
. (_) @parameter.inner @parameter.outer._start
. ","? @parameter.outer._end
)

(array
"," @parameter.outer._start .
(_) @parameter.inner @parameter.outer._end
)

(array
. (_) @parameter.inner @parameter.outer._start
. ","? @parameter.outer._end
)

Loading

0 comments on commit f440811

Please sign in to comment.