From 5b250fdd0df6338e7eff1c7ca76fe201ef4be5ba Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:56:41 +0000 Subject: [PATCH] Support `as const` for `"type"` --- .../languages/typescript/changeType9.yml | 23 +++++++++++++++++++ .../languages/typescript/chuckType5.yml | 23 +++++++++++++++++++ queries/typescript.core.scm | 5 +--- 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeType9.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/chuckType5.yml diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeType9.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeType9.yml new file mode 100644 index 0000000000..2f34eb03e8 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/changeType9.yml @@ -0,0 +1,23 @@ +languageId: typescript +command: + version: 6 + spokenForm: change type + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: type} + usePrePhraseSnapshot: true +initialState: + documentContents: const aaa = "bbb" as const; + selections: + - anchor: {line: 0, character: 12} + active: {line: 0, character: 12} + marks: {} +finalState: + documentContents: const aaa = "bbb" as ; + selections: + - anchor: {line: 0, character: 21} + active: {line: 0, character: 21} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/chuckType5.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/chuckType5.yml new file mode 100644 index 0000000000..b3fc76c207 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/chuckType5.yml @@ -0,0 +1,23 @@ +languageId: typescript +command: + version: 6 + spokenForm: chuck type + action: + name: remove + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: type} + usePrePhraseSnapshot: true +initialState: + documentContents: const aaa = "bbb" as const; + selections: + - anchor: {line: 0, character: 12} + active: {line: 0, character: 12} + marks: {} +finalState: + documentContents: const aaa = "bbb"; + selections: + - anchor: {line: 0, character: 12} + active: {line: 0, character: 12} diff --git a/queries/typescript.core.scm b/queries/typescript.core.scm index 12ec9443e8..f57f699277 100644 --- a/queries/typescript.core.scm +++ b/queries/typescript.core.scm @@ -198,10 +198,7 @@ ;;! ---------- (as_expression (_) @_.leading.start.endOf - [ - (generic_type) - (predefined_type) - ] @type @_.leading.end.startOf + (_) @type @_.leading.end.startOf ) @_.domain ;;!! aaa satisfies Bbb