Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update queries to latest #98

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/update-queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Update repos
run: |
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter-textobjects /tmp/nts
rm -r queries && mv /tmp/nts/queries .
rm -r queries && cp -r /tmp/nts/queries .
./scripts/fix-queries
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
Expand Down
3 changes: 3 additions & 0 deletions queries/scala/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
(class_parameter
name: (identifier) @parameter.inner) @parameter.outer

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

(comment) @comment.outer

29 changes: 20 additions & 9 deletions queries/v/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
;; assignment
[(short_var_declaration
left: (_) @assignment.lhs
right: (_)* @assignment.rhs)
[(var_declaration
var_list: (_) @assignment.lhs
expression_list: (_)* @assignment.rhs)
(assignment_statement
left: (_) @assignment.lhs
right: (_)* @assignment.rhs)]

[(short_var_declaration
left: (_) @assignment.inner)
[(var_declaration
var_list: (_) @assignment.inner)
(assignment_statement
left: (_) @assignment.inner)]

[(short_var_declaration
right: (_) @assignment.inner)
[(var_declaration
expression_list: (_) @assignment.inner)
(assignment_statement
right: (_) @assignment.inner)]

Expand All @@ -28,7 +28,7 @@

;; class: structs
(struct_declaration
(struct_field_declaration_list . "{" . (_) @class.inner._start @class.inner._end (_)? @class.inner._end . "}"
("{" . (_) @class.inner._start @class.inner._end (_)? @class.inner._end . "}"
))

(struct_declaration) @class.outer
Expand All @@ -45,7 +45,7 @@

;; conditional
(if_expression
consequence: (block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
block: (block . "{" . (_) @conditional.inner._start @conditional.inner._end (_)? @conditional.inner._end . "}"
)?) @conditional.outer

;; function
Expand All @@ -71,3 +71,14 @@
(parameter_declaration) @parameter.inner @parameter.outer._end
)

(parameter_list
. (parameter_declaration) @parameter.inner @parameter.outer._start
. ","? @parameter.outer._end
)

;; return
(return_statement (_)* @return.inner) @return.outer

;; statements
(block (_) @statement.outer)

2 changes: 1 addition & 1 deletion scripts/fix-queries
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ set -e
find queries -type f |
while read -r file; do
echo "Processing $file"
go run converter/main.go "$file" > "$file.new"
go run converter/main.go "$file" | sed 's|#lua-match|#match|' > "$file.new"
mv "$file.new" "$file"
done
Loading