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 Oct 20, 2023
1 parent db6ab40 commit 2ed30be
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
4 changes: 4 additions & 0 deletions queries/c_sharp/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
body: (block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}"
)) @function.outer

(constructor_declaration
body: (block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}"
)) @function.outer

(lambda_expression
body: (block . "{" . (_) @function.inner._start @function.inner._end (_)? @function.inner._end . "}"
)) @function.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
17 changes: 17 additions & 0 deletions queries/nasm/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
;; adapted from https://github.com/naclsn/tree-sitter-nasm/blob/main/queries/textobjects.scm

(preproc_multiline_macro
body: (body) @function.inner) @function.outer
(struc_declaration
body: (struc_declaration_body) @class.inner) @class.outer
(struc_instance
body: (struc_instance_body) @class.inner) @class.outer

(preproc_function_def_parameters
(word) @parameter.inner)
(call_syntax_arguments
(_) @parameter.inner)
(operand) @parameter.inner

(comment) @comment.outer

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 2ed30be

Please sign in to comment.