From 9ed7ff47eea96dc28cd795007c6fdd3cd5418a88 Mon Sep 17 00:00:00 2001 From: sharpchen Date: Sat, 13 Sep 2025 23:23:12 +0800 Subject: [PATCH] feat(c_sharp): support more @function capture Property, indexer, operator, conversion operator are special functions that we should support `@function` captures for them, as well as local function and delegate expression --- queries/c_sharp/textobjects.scm | 90 +++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/queries/c_sharp/textobjects.scm b/queries/c_sharp/textobjects.scm index 0366ec80..43ecb83a 100644 --- a/queries/c_sharp/textobjects.scm +++ b/queries/c_sharp/textobjects.scm @@ -44,6 +44,72 @@ body: (arrow_expression_clause _+ @function.inner)) @function.outer +; method without body(abstract method/decompiled metadata) +(method_declaration + _+ + ";") @function.outer + +(property_declaration + accessors: (accessor_list + (accessor_declaration + body: (block + . + "{" + _* @function.inner + "}")) @function.outer)) + +(property_declaration + accessors: (accessor_list + (accessor_declaration + body: (arrow_expression_clause + "=>" + _* @function.inner)) @function.outer)) + +(indexer_declaration + accessors: (accessor_list + (accessor_declaration + body: (arrow_expression_clause + "=>" + _+ @function.inner)) @function.outer)) + +(indexer_declaration + accessors: (accessor_list + (accessor_declaration + body: (block + . + "{" + _* @function.inner + "}")) @function.outer)) + +(conversion_operator_declaration + body: (block + . + "{" + _* @function.inner + "}")) @function.outer + +(conversion_operator_declaration + body: (arrow_expression_clause + "=>" + _+ @function.inner)) @function.outer + +(operator_declaration + body: (block + . + "{" + _* @function.inner + "}")) @function.outer + +; operator without body(abstract/decompiled metadata) +(operator_declaration + _+ + ";") @function.outer + +(operator_declaration + body: (arrow_expression_clause + "=>" + _+ @function.inner)) @function.outer + (constructor_declaration body: (block . @@ -51,6 +117,30 @@ _+ @function.inner "}")) @function.outer +; constructor without body(metadata) +(constructor_declaration + _+ + ";") @function.outer + +(local_function_statement + body: (block + . + "{" + _* @function.inner + "}")) @function.outer + +(local_function_statement + body: (arrow_expression_clause + "=>" + _+ @function.inner)) @function.outer + +(anonymous_method_expression + (block + . + "{" + _* @function.inner + "}")) @function.outer + (lambda_expression body: (block .