From 3a98ae3b33e5089b2a8574c2d126acef9eab3cf8 Mon Sep 17 00:00:00 2001 From: AndrewDant Date: Sun, 19 May 2024 11:16:07 -0400 Subject: [PATCH] csharp migrate classname --- data/fixtures/scopes/csharp/className.scope | 21 +++++++++++++++++++ .../common/src/scopeSupportFacets/csharp.ts | 1 + .../cursorless-engine/src/languages/csharp.ts | 1 - queries/csharp.scm | 3 ++- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 data/fixtures/scopes/csharp/className.scope diff --git a/data/fixtures/scopes/csharp/className.scope b/data/fixtures/scopes/csharp/className.scope new file mode 100644 index 0000000000..f3a44acc12 --- /dev/null +++ b/data/fixtures/scopes/csharp/className.scope @@ -0,0 +1,21 @@ +public class BankAccount {} +--- + +[Content] = +[Domain] = 0:13-0:24 + >-----------< +0| public class BankAccount {} + +[Removal] = 0:13-0:25 + >------------< +0| public class BankAccount {} + +[Leading delimiter] = 0:12-0:13 + >-< +0| public class BankAccount {} + +[Trailing delimiter] = 0:24-0:25 + >-< +0| public class BankAccount {} + +[Insertion delimiter] = " " diff --git a/packages/common/src/scopeSupportFacets/csharp.ts b/packages/common/src/scopeSupportFacets/csharp.ts index 26bda305b7..357cbb480a 100644 --- a/packages/common/src/scopeSupportFacets/csharp.ts +++ b/packages/common/src/scopeSupportFacets/csharp.ts @@ -11,4 +11,5 @@ const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel; export const csharpScopeSupport: LanguageScopeSupportFacetMap = { ifStatement: supported, class: supported, + className: supported, }; diff --git a/packages/cursorless-engine/src/languages/csharp.ts b/packages/cursorless-engine/src/languages/csharp.ts index ad2904667b..33fb157a9e 100644 --- a/packages/cursorless-engine/src/languages/csharp.ts +++ b/packages/cursorless-engine/src/languages/csharp.ts @@ -139,7 +139,6 @@ const nodeMatchers: Partial< Record > = { ...getMapMatchers, - className: "class_declaration[name]", condition: cascadingMatcher( conditionMatcher("*[condition]"), patternMatcher("while_statement[0]"), diff --git a/queries/csharp.scm b/queries/csharp.scm index e6fa1b56e9..cfb109115c 100644 --- a/queries/csharp.scm +++ b/queries/csharp.scm @@ -1,5 +1,6 @@ (if_statement) @ifStatement -(class_declaration) @class +(class_declaration +name: (identifier) @className) @class ( (string_literal) @string @textFragment (#child-range! @textFragment 0 -1 true true)