From c034aa61c522387273a727cccbd482318f16e87c Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:19:54 +0100 Subject: [PATCH 1/2] Fix value scope nesting in Typescript --- queries/javascript.core.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 371adda430..920524256d 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -353,11 +353,14 @@ ;; Match nodes at field `value` of their parent node, setting leading delimiter ;; to be the range until the previous named node -(_ - (_)? @value.leading.start.endOf - . - value: (_) @value @value.leading.end.startOf -) @_.domain +( + (_ + (_)? @value.leading.start.endOf + . + value: (_) @value @value.leading.end.startOf + ) @_.domain + (#not-type? @_.domain variable_declarator) +) ;;!! const aaa = {bbb}; ;;! ^^^ From 70d131b068b3c7b8c90b17efae1dabd213d9aceb Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:32:03 +0100 Subject: [PATCH 2/2] Add test --- .../languages/typescript/changeNextValue.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeNextValue.yml diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeNextValue.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeNextValue.yml new file mode 100644 index 0000000000..3abb6a3554 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeNextValue.yml @@ -0,0 +1,30 @@ +languageId: typescript +command: + version: 6 + spokenForm: change next value + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: relativeScope + scopeType: {type: value} + offset: 1 + length: 1 + direction: forward + usePrePhraseSnapshot: true +initialState: + documentContents: |- + const aaa = 0; + const bbb = 0; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: {} +finalState: + documentContents: |- + const aaa = 0; + const bbb = ; + selections: + - anchor: {line: 1, character: 12} + active: {line: 1, character: 12}