Skip to content
Open
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
61 changes: 61 additions & 0 deletions queries/c_sharp/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,64 @@

; comments
(comment) @comment.outer

; assignments
(field_declaration
(_)
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs
(_) @assignment.rhs) @assignment.inner)) @assignment.outer

(field_declaration
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs
(_) @assignment.rhs) @assignment.inner)) @assignment.outer

(field_declaration
(_)
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs @assignment.inner))) @assignment.outer

(local_declaration_statement
(_)
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs
(_) @assignment.rhs) @assignment.inner)) @assignment.outer

(local_declaration_statement
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs
(_) @assignment.rhs) @assignment.inner)) @assignment.outer

(local_declaration_statement
(_)
(variable_declaration
type: (_)
(variable_declarator
name: (_) @assignment.lhs @assignment.inner))) @assignment.outer

(expression_statement
(assignment_expression
left: (_) @assignment.lhs
right: (_) @assignment.rhs)) @assignment.inner @assignment.outer
Copy link
Collaborator

@kiyoon kiyoon Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inner and outer should not mean the same thing. Inner refers to "either" LHS or RHS, outer means select both. Sorry, this isn't documented very clearly as of now. (although I wrote a comment on this query, all queries seem to be wrong and need to be fixed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will fix these queries and add test cases.


(method_declaration
name: (_) @assignment.lhs
body: (arrow_expression_clause
(_) @assignment.rhs) @assignment.inner) @assignment.outer

(local_function_statement
type: (_)
name: (_) @assignment.lhs
body: (arrow_expression_clause
(_) @assignment.rhs)) @assignment.inner @assignment.outer
Loading