From 8f6dfd160941c2ca8bc23a890b9bd1e0bea8cb94 Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:41:10 +0100 Subject: [PATCH] Add `"access"` scope type (#1519) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implements #707 for Typescript - Implements #707 for Python ## Questions - [ ] Unfortunately, both the queries and tests are almost identically duplicated between Typescript and Python 😕. - [ ] I wonder if we should support some kind of templating language, eg handlebars, along with a meta-updater-style approach where we keep the generated files in source control as well - [ ] For the test cases, we could maybe support a list of language ids in the recorded test yaml 🤷‍♂️ - [ ] Also, should the `.` be considered part of the content range, or just the removal range? - [ ] Should a function call on its own be considered `"access"`? eg `foo()`. What about an identifier on its own, eg `foo`? ## Checklist - [ ] Make it so eg `bar` or `foo()` on its own is an access? That might cover a lot of things 🤔. Eg what happens with something in parens? That could end up as part of access, eg `(a + b).c` - [ ] What does happen with `(a + b).c`? - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [x] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [x] I have not broken the cheatsheet --- cursorless-talon/src/cheatsheet/get_list.py | 6 +- cursorless-talon/src/csv_overrides.py | 102 ++++++++++------- cursorless-talon/src/spoken_forms.py | 2 + .../command/PartialTargetDescriptor.types.ts | 1 + .../defaultSpokenForms/modifiers.ts | 1 + .../primitiveTargetToSpokenForm.ts | 1 + .../languages/python/clearAccessAir.yml | 29 +++++ .../languages/python/clearAccessBat.yml | 29 +++++ .../languages/python/clearAccessBat3.yml | 29 +++++ .../languages/python/clearAccessBat5.yml | 31 ++++++ .../languages/python/clearAccessCap.yml | 29 +++++ .../languages/python/clearAccessCap2.yml | 29 +++++ .../languages/python/clearAccessCap3.yml | 29 +++++ .../languages/python/clearAccessDrum.yml | 29 +++++ .../languages/python/clearAccessDrum2.yml | 29 +++++ .../languages/python/clearAccessEach.yml | 29 +++++ .../languages/python/clearAccessEach2.yml | 29 +++++ .../languages/python/clearAccessFine.yml | 29 +++++ .../languages/python/clearEveryAccessAir.yml | 41 +++++++ .../languages/python/takeEveryAccess.yml | 25 +++++ .../languages/python/takeEveryAccessAir.yml | 35 ++++++ .../languages/python/takeEveryAccessAir2.yml | 31 ++++++ .../languages/python/takeEveryAccessBat.yml | 35 ++++++ .../languages/python/takeEveryAccessBat2.yml | 31 ++++++ .../languages/python/takeEveryAccessCap.yml | 35 ++++++ .../languages/python/takeEveryAccessCap2.yml | 31 ++++++ .../languages/python/takeEveryAccessDrum.yml | 35 ++++++ .../languages/python/takeEveryAccessDrum2.yml | 31 ++++++ .../languages/python/takeEveryAccessEach.yml | 35 ++++++ .../languages/python/takeEveryAccessEach2.yml | 31 ++++++ .../languages/typescript/clearAccessAir.yml | 29 +++++ .../languages/typescript/clearAccessAir2.yml | 29 +++++ .../languages/typescript/clearAccessAir3.yml | 29 +++++ .../languages/typescript/clearAccessBat.yml | 29 +++++ .../languages/typescript/clearAccessBat2.yml | 29 +++++ .../languages/typescript/clearAccessBat3.yml | 29 +++++ .../languages/typescript/clearAccessBat4.yml | 29 +++++ .../languages/typescript/clearAccessBat5.yml | 31 ++++++ .../languages/typescript/clearAccessCap.yml | 29 +++++ .../languages/typescript/clearAccessCap2.yml | 29 +++++ .../languages/typescript/clearAccessCap3.yml | 29 +++++ .../languages/typescript/clearAccessDrum.yml | 29 +++++ .../languages/typescript/clearAccessDrum2.yml | 29 +++++ .../languages/typescript/clearAccessEach.yml | 29 +++++ .../languages/typescript/clearAccessEach2.yml | 29 +++++ .../languages/typescript/clearAccessFine.yml | 29 +++++ .../typescript/clearEveryAccessAir.yml | 37 ++++++ .../languages/typescript/takeEveryAccess.yml | 25 +++++ .../typescript/takeEveryAccessAir.yml | 35 ++++++ .../typescript/takeEveryAccessAir2.yml | 31 ++++++ .../typescript/takeEveryAccessBat.yml | 35 ++++++ .../typescript/takeEveryAccessBat2.yml | 31 ++++++ .../typescript/takeEveryAccessBat3.yml | 31 ++++++ .../typescript/takeEveryAccessCap.yml | 35 ++++++ .../typescript/takeEveryAccessCap2.yml | 31 ++++++ .../typescript/takeEveryAccessDrum.yml | 35 ++++++ .../typescript/takeEveryAccessDrum2.yml | 31 ++++++ .../typescript/takeEveryAccessEach.yml | 35 ++++++ .../typescript/takeEveryAccessEach2.yml | 31 ++++++ queries/javascript.core.scm | 1 + queries/javascript.fieldAccess.scm | 105 ++++++++++++++++++ queries/python.fieldAccess.scm | 93 ++++++++++++++++ queries/python.scm | 2 + 63 files changed, 1909 insertions(+), 40 deletions(-) create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat5.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessFine.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearEveryAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccess.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat4.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat5.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessFine.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearEveryAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccess.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach2.yml create mode 100644 queries/javascript.fieldAccess.scm create mode 100644 queries/python.fieldAccess.scm diff --git a/cursorless-talon/src/cheatsheet/get_list.py b/cursorless-talon/src/cheatsheet/get_list.py index 001feaa1cc1..f60696bb9b9 100644 --- a/cursorless-talon/src/cheatsheet/get_list.py +++ b/cursorless-talon/src/cheatsheet/get_list.py @@ -59,8 +59,12 @@ def make_dict_readable( def make_readable(text: str) -> str: + text, is_private = ( + (text[8:], True) if text.startswith("private.") else (text, False) + ) text = text.replace(".", " ") - return de_camel(text).lower().capitalize() + text = de_camel(text).lower().capitalize() + return f"{text} (PRIVATE)" if is_private else text def de_camel(text: str) -> str: diff --git a/cursorless-talon/src/csv_overrides.py b/cursorless-talon/src/csv_overrides.py index 4c51b7c3a49..aa49b5dc478 100644 --- a/cursorless-talon/src/csv_overrides.py +++ b/cursorless-talon/src/csv_overrides.py @@ -35,12 +35,13 @@ def init_csv_and_watch_changes( filename: str, default_values: dict[str, dict[str, str]], extra_ignored_values: Optional[list[str]] = None, + extra_allowed_values: Optional[list[str]] = None, allow_unknown_values: bool = False, default_list_name: Optional[str] = None, headers: list[str] = [SPOKEN_FORM_HEADER, CURSORLESS_IDENTIFIER_HEADER], ctx: Context = Context(), no_update_file: bool = False, - pluralize_lists: Optional[list[str]] = [], + pluralize_lists: Optional[list[str]] = None, ): """ Initialize a cursorless settings csv, creating it if necessary, and watch @@ -69,8 +70,21 @@ def init_csv_and_watch_changes( not update the csv. This is used generally in case there was an issue coming up with the default set of values so we don't want to persist those to disk pluralize_lists: Create plural version of given lists """ + # Don't allow both `extra_allowed_values` and `allow_unknown_values` + assert not (extra_allowed_values and allow_unknown_values) + + # If `extra_allowed_values` or `allow_unknown_values` is given, we need a + # `default_list_name` to put unknown values in + assert not ( + (extra_allowed_values or allow_unknown_values) and not default_list_name + ) + if extra_ignored_values is None: extra_ignored_values = [] + if extra_allowed_values is None: + extra_allowed_values = [] + if pluralize_lists is None: + pluralize_lists = [] file_path = get_full_path(filename) super_default_values = get_super_values(default_values) @@ -83,53 +97,58 @@ def init_csv_and_watch_changes( def on_watch(path, flags): if file_path.match(path): current_values, has_errors = read_file( - file_path, - headers, - super_default_values.values(), - extra_ignored_values, - allow_unknown_values, + path=file_path, + headers=headers, + default_identifiers=super_default_values.values(), + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, ) update_dicts( - default_values, - current_values, - extra_ignored_values, - allow_unknown_values, - default_list_name, - pluralize_lists, - ctx, + default_values=default_values, + current_values=current_values, + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, + default_list_name=default_list_name, + pluralize_lists=pluralize_lists, + ctx=ctx, ) fs.watch(str(file_path.parent), on_watch) if file_path.is_file(): current_values = update_file( - file_path, - headers, - super_default_values, - extra_ignored_values, - allow_unknown_values, - no_update_file, + path=file_path, + headers=headers, + default_values=super_default_values, + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, + no_update_file=no_update_file, ) update_dicts( - default_values, - current_values, - extra_ignored_values, - allow_unknown_values, - default_list_name, - pluralize_lists, - ctx, + default_values=default_values, + current_values=current_values, + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, + default_list_name=default_list_name, + pluralize_lists=pluralize_lists, + ctx=ctx, ) else: if not no_update_file: create_file(file_path, headers, super_default_values) update_dicts( - default_values, - super_default_values, - extra_ignored_values, - allow_unknown_values, - default_list_name, - pluralize_lists, - ctx, + default_values=default_values, + current_values=super_default_values, + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, + default_list_name=default_list_name, + pluralize_lists=pluralize_lists, + ctx=ctx, ) def unsubscribe(): @@ -172,6 +191,7 @@ def update_dicts( default_values: dict[str, dict], current_values: dict, extra_ignored_values: list[str], + extra_allowed_values: list[str], allow_unknown_values: bool, default_list_name: Optional[str], pluralize_lists: list[str], @@ -190,7 +210,7 @@ def update_dicts( except KeyError: if value in extra_ignored_values: pass - elif allow_unknown_values: + elif allow_unknown_values or value in extra_allowed_values: results_map[value] = { "key": key, "value": value, @@ -238,15 +258,17 @@ def update_file( headers: list[str], default_values: dict[str, str], extra_ignored_values: list[str], + extra_allowed_values: list[str], allow_unknown_values: bool, no_update_file: bool, ): current_values, has_errors = read_file( - path, - headers, - default_values.values(), - extra_ignored_values, - allow_unknown_values, + path=path, + headers=headers, + default_identifiers=default_values.values(), + extra_ignored_values=extra_ignored_values, + extra_allowed_values=extra_allowed_values, + allow_unknown_values=allow_unknown_values, ) current_identifiers = current_values.values() @@ -311,6 +333,7 @@ def read_file( headers: list[str], default_identifiers: Container[str], extra_ignored_values: list[str], + extra_allowed_values: list[str], allow_unknown_values: bool, ): with open(path) as csv_file: @@ -353,6 +376,7 @@ def read_file( if ( value not in default_identifiers and value not in extra_ignored_values + and value not in extra_allowed_values and not allow_unknown_values ): has_errors = True diff --git a/cursorless-talon/src/spoken_forms.py b/cursorless-talon/src/spoken_forms.py index 16d53205f5d..d2ff43da35a 100644 --- a/cursorless-talon/src/spoken_forms.py +++ b/cursorless-talon/src/spoken_forms.py @@ -72,6 +72,8 @@ def update(): handle_csv( "modifier_scope_types.csv", pluralize_lists=["scope_type"], + extra_allowed_values=["private.fieldAccess"], + default_list_name="scope_type", ), handle_csv( "experimental/wrapper_snippets.csv", diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index 799aa47e858..ccc45f19ed1 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -105,6 +105,7 @@ export type SimpleScopeTypeType = | "collectionItem" | "collectionKey" | "comment" + | "private.fieldAccess" | "functionCall" | "functionCallee" | "functionName" diff --git a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts index 88852cc14cf..06f10b91d18 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/modifiers.ts @@ -101,6 +101,7 @@ export const scopeSpokenForms = { notebookCell: "cell", switchStatementSubject: null, + ["private.fieldAccess"]: null, } as const satisfies Record; type ExtendedSurroundingPairName = SurroundingPairName | "whitespace"; diff --git a/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts b/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts index 59452aa7759..9cda195b59d 100644 --- a/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts +++ b/packages/cursorless-engine/src/generateSpokenForm/primitiveTargetToSpokenForm.ts @@ -196,6 +196,7 @@ function scopeTypeToSpokenForm(scopeType: ScopeType): string { case "oneOf": case "customRegex": case "switchStatementSubject": + case "private.fieldAccess": case "string": throw new NoSpokenFormError(`Scope type '${scopeType.type}'`); case "surroundingPair": { diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessAir.yml new file mode 100644 index 00000000000..4b98fd0b058 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessAir.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 3} +finalState: + documentContents: | + .bbb.ccc().ddd + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat.yml new file mode 100644 index 00000000000..8d788acd33f --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 6} + end: {line: 0, character: 9} +finalState: + documentContents: | + aaa().ccc().ddd + selections: + - anchor: {line: 0, character: 5} + active: {line: 0, character: 5} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat3.yml new file mode 100644 index 00000000000..49bafcd2092 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat3.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 5} + end: {line: 0, character: 6} +finalState: + documentContents: | + a[0] + selections: + - anchor: {line: 0, character: 4} + active: {line: 0, character: 4} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat5.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat5.yml new file mode 100644 index 00000000000..0632a701c27 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessBat5.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa.bbb( + ccc + 5 + ) + selections: + - anchor: {line: 3, character: 0} + active: {line: 3, character: 0} + marks: + default.b: + start: {line: 0, character: 4} + end: {line: 0, character: 7} +finalState: + documentContents: | + aaa + selections: + - anchor: {line: 0, character: 3} + active: {line: 0, character: 3} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap.yml new file mode 100644 index 00000000000..becce34a700 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 10} + end: {line: 0, character: 13} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap2.yml new file mode 100644 index 00000000000..b35b7656a47 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap2.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 10} + end: {line: 0, character: 13} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap3.yml new file mode 100644 index 00000000000..5ecea40d2b2 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessCap3.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d()] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 7} + end: {line: 0, character: 8} +finalState: + documentContents: | + a[0].b[.d()] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 7} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum.yml new file mode 100644 index 00000000000..1b4121234a3 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access drum + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 16} + end: {line: 0, character: 19} +finalState: + documentContents: | + aaa().bbb.ccc() + selections: + - anchor: {line: 0, character: 15} + active: {line: 0, character: 15} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum2.yml new file mode 100644 index 00000000000..8099913a3ae --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessDrum2.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access drum + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d()] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 9} + end: {line: 0, character: 10} +finalState: + documentContents: | + a[0].b[c] + selections: + - anchor: {line: 0, character: 8} + active: {line: 0, character: 8} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach.yml new file mode 100644 index 00000000000..acf32cdebcd --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access each + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 14} + end: {line: 0, character: 17} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach2.yml new file mode 100644 index 00000000000..15bfd18e0f4 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessEach2.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access each + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 14} + end: {line: 0, character: 17} +finalState: + documentContents: | + aaa().bbb.ccc(.fff).ddd + selections: + - anchor: {line: 0, character: 14} + active: {line: 0, character: 14} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessFine.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessFine.yml new file mode 100644 index 00000000000..b98a509d435 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearAccessFine.yml @@ -0,0 +1,29 @@ +languageId: python +command: + version: 5 + spokenForm: clear access fine + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: f} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.f: + start: {line: 0, character: 18} + end: {line: 0, character: 21} +finalState: + documentContents: | + aaa().bbb.ccc(eee).ddd + selections: + - anchor: {line: 0, character: 17} + active: {line: 0, character: 17} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearEveryAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearEveryAccessAir.yml new file mode 100644 index 00000000000..00c75f2f279 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/clearEveryAccessAir.yml @@ -0,0 +1,41 @@ +languageId: python +command: + version: 5 + spokenForm: clear every access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + ( + aaa + .bbb + .ccc + ) + selections: + - anchor: {line: 5, character: 0} + active: {line: 5, character: 0} + marks: + default.a: + start: {line: 1, character: 4} + end: {line: 1, character: 7} +finalState: + documentContents: | + ( + + + + ) + selections: + - anchor: {line: 1, character: 4} + active: {line: 1, character: 4} + - anchor: {line: 2, character: 4} + active: {line: 2, character: 4} + - anchor: {line: 3, character: 4} + active: {line: 3, character: 4} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccess.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccess.yml new file mode 100644 index 00000000000..42bb5aedc9e --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccess.yml @@ -0,0 +1,25 @@ +languageId: python +command: + version: 5 + spokenForm: take every access + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: aaa.bbb() + ccc() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: {} +finalState: + documentContents: aaa.bbb() + ccc() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir.yml new file mode 100644 index 00000000000..6918a185fb8 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir.yml @@ -0,0 +1,35 @@ +languageId: python +command: + version: 5 + spokenForm: take every access air + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 1} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir2.yml new file mode 100644 index 00000000000..a2410c06fb7 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessAir2.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: take every access air + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 1} +finalState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat.yml new file mode 100644 index 00000000000..d23f897cac2 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat.yml @@ -0,0 +1,35 @@ +languageId: python +command: + version: 5 + spokenForm: take every access bat + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 4} + end: {line: 0, character: 5} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat2.yml new file mode 100644 index 00000000000..cf8581063e9 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessBat2.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: take every access bat + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 5} + end: {line: 0, character: 6} +finalState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap.yml new file mode 100644 index 00000000000..d82f52ab12b --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap.yml @@ -0,0 +1,35 @@ +languageId: python +command: + version: 5 + spokenForm: take every access cap + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 6} + end: {line: 0, character: 7} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap2.yml new file mode 100644 index 00000000000..627f54fe33f --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessCap2.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: take every access cap + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 7} + end: {line: 0, character: 8} +finalState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 8} + - anchor: {line: 0, character: 8} + active: {line: 0, character: 10} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum.yml new file mode 100644 index 00000000000..a4f0a028f22 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum.yml @@ -0,0 +1,35 @@ +languageId: python +command: + version: 5 + spokenForm: take every access drum + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 10} + end: {line: 0, character: 11} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum2.yml new file mode 100644 index 00000000000..911286cbdf3 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessDrum2.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: take every access drum + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 9} + end: {line: 0, character: 10} +finalState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 8} + - anchor: {line: 0, character: 8} + active: {line: 0, character: 10} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach.yml new file mode 100644 index 00000000000..3a95625e033 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach.yml @@ -0,0 +1,35 @@ +languageId: python +command: + version: 5 + spokenForm: take every access each + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c(e).d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 8} + end: {line: 0, character: 9} +finalState: + documentContents: | + a().b.c(e).d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 10} + - anchor: {line: 0, character: 10} + active: {line: 0, character: 12} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach2.yml new file mode 100644 index 00000000000..c7b408ba6c5 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/python/takeEveryAccessEach2.yml @@ -0,0 +1,31 @@ +languageId: python +command: + version: 5 + spokenForm: take every access each + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c(e.f).d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 8} + end: {line: 0, character: 9} +finalState: + documentContents: | + a().b.c(e.f).d; + selections: + - anchor: {line: 0, character: 8} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir.yml new file mode 100644 index 00000000000..a9deceb5364 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 3} +finalState: + documentContents: | + .bbb.ccc().ddd + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir2.yml new file mode 100644 index 00000000000..99a14bfa7d8 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir2.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa?.bbb() + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 3} +finalState: + documentContents: | + ?.bbb() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir3.yml new file mode 100644 index 00000000000..4f7124d3cc8 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessAir3.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a?.[0].b?.() + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 1} +finalState: + documentContents: | + .b?.() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat.yml new file mode 100644 index 00000000000..ca8858e530c --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 6} + end: {line: 0, character: 9} +finalState: + documentContents: | + aaa().ccc().ddd + selections: + - anchor: {line: 0, character: 5} + active: {line: 0, character: 5} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat2.yml new file mode 100644 index 00000000000..272a33731d5 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat2.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa?.bbb() + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 5} + end: {line: 0, character: 8} +finalState: + documentContents: | + aaa + selections: + - anchor: {line: 0, character: 3} + active: {line: 0, character: 3} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat3.yml new file mode 100644 index 00000000000..7455ffcb2ff --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat3.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 5} + end: {line: 0, character: 6} +finalState: + documentContents: | + a[0] + selections: + - anchor: {line: 0, character: 4} + active: {line: 0, character: 4} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat4.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat4.yml new file mode 100644 index 00000000000..960653badbc --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat4.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a?.[0].b?.() + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 7} + end: {line: 0, character: 8} +finalState: + documentContents: | + a?.[0] + selections: + - anchor: {line: 0, character: 6} + active: {line: 0, character: 6} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat5.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat5.yml new file mode 100644 index 00000000000..8b513549843 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessBat5.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access bat + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa.bbb( + ccc + 5 + ) + selections: + - anchor: {line: 3, character: 0} + active: {line: 3, character: 0} + marks: + default.b: + start: {line: 0, character: 4} + end: {line: 0, character: 7} +finalState: + documentContents: | + aaa + selections: + - anchor: {line: 0, character: 3} + active: {line: 0, character: 3} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap.yml new file mode 100644 index 00000000000..ae4fe1ab380 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 10} + end: {line: 0, character: 13} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap2.yml new file mode 100644 index 00000000000..ec3d5b8b56d --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap2.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 10} + end: {line: 0, character: 13} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap3.yml new file mode 100644 index 00000000000..6806548f42a --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessCap3.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access cap + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d()] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 7} + end: {line: 0, character: 8} +finalState: + documentContents: | + a[0].b[.d()] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 7} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum.yml new file mode 100644 index 00000000000..311fe3475ea --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access drum + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc().ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 16} + end: {line: 0, character: 19} +finalState: + documentContents: | + aaa().bbb.ccc() + selections: + - anchor: {line: 0, character: 15} + active: {line: 0, character: 15} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum2.yml new file mode 100644 index 00000000000..0b4df7cba38 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessDrum2.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access drum + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d()] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 9} + end: {line: 0, character: 10} +finalState: + documentContents: | + a[0].b[c] + selections: + - anchor: {line: 0, character: 8} + active: {line: 0, character: 8} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach.yml new file mode 100644 index 00000000000..dbc36d4a5dc --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access each + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 14} + end: {line: 0, character: 17} +finalState: + documentContents: | + aaa().bbb.ddd + selections: + - anchor: {line: 0, character: 9} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach2.yml new file mode 100644 index 00000000000..905de811cc3 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessEach2.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access each + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 14} + end: {line: 0, character: 17} +finalState: + documentContents: | + aaa().bbb.ccc(.fff).ddd + selections: + - anchor: {line: 0, character: 14} + active: {line: 0, character: 14} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessFine.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessFine.yml new file mode 100644 index 00000000000..c83d3de18aa --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearAccessFine.yml @@ -0,0 +1,29 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear access fine + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: containingScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: f} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa().bbb.ccc(eee.fff).ddd + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.f: + start: {line: 0, character: 18} + end: {line: 0, character: 21} +finalState: + documentContents: | + aaa().bbb.ccc(eee).ddd + selections: + - anchor: {line: 0, character: 17} + active: {line: 0, character: 17} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearEveryAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearEveryAccessAir.yml new file mode 100644 index 00000000000..0fb01ad1643 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/clearEveryAccessAir.yml @@ -0,0 +1,37 @@ +languageId: typescript +command: + version: 5 + spokenForm: clear every access air + action: {name: clearAndSetSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + aaa + .bbb + .ccc + selections: + - anchor: {line: 3, character: 0} + active: {line: 3, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 3} +finalState: + documentContents: |+ + + + + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + - anchor: {line: 2, character: 0} + active: {line: 2, character: 0} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccess.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccess.yml new file mode 100644 index 00000000000..ee2c321c9c2 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccess.yml @@ -0,0 +1,25 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: aaa.bbb() + ccc() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 0} + marks: {} +finalState: + documentContents: aaa.bbb() + ccc() + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir.yml new file mode 100644 index 00000000000..345af573963 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir.yml @@ -0,0 +1,35 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access air + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 1} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir2.yml new file mode 100644 index 00000000000..9e2716cd6de --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessAir2.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access air + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: a} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.a: + start: {line: 0, character: 0} + end: {line: 0, character: 1} +finalState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat.yml new file mode 100644 index 00000000000..5c11e3c3c0e --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat.yml @@ -0,0 +1,35 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access bat + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 4} + end: {line: 0, character: 5} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat2.yml new file mode 100644 index 00000000000..08b85314572 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat2.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access bat + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 5} + end: {line: 0, character: 6} +finalState: + documentContents: | + a[0].b[1] + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 4} + - anchor: {line: 0, character: 4} + active: {line: 0, character: 9} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat3.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat3.yml new file mode 100644 index 00000000000..d9dab15eb0a --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessBat3.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access bat + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: b} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a.b`c d` + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.b: + start: {line: 0, character: 2} + end: {line: 0, character: 3} +finalState: + documentContents: | + a.b`c d` + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 1} + - anchor: {line: 0, character: 1} + active: {line: 0, character: 8} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap.yml new file mode 100644 index 00000000000..fdf7fe9f8b9 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap.yml @@ -0,0 +1,35 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access cap + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 6} + end: {line: 0, character: 7} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap2.yml new file mode 100644 index 00000000000..f6c29dd04f7 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessCap2.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access cap + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: c} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.c: + start: {line: 0, character: 7} + end: {line: 0, character: 8} +finalState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 8} + - anchor: {line: 0, character: 8} + active: {line: 0, character: 10} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum.yml new file mode 100644 index 00000000000..a86fe8773b9 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum.yml @@ -0,0 +1,35 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access drum + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 10} + end: {line: 0, character: 11} +finalState: + documentContents: | + a().b.c().d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum2.yml new file mode 100644 index 00000000000..16d60e6b7bc --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessDrum2.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access drum + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: d} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.d: + start: {line: 0, character: 9} + end: {line: 0, character: 10} +finalState: + documentContents: | + a[0].b[c.d] + selections: + - anchor: {line: 0, character: 7} + active: {line: 0, character: 8} + - anchor: {line: 0, character: 8} + active: {line: 0, character: 10} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach.yml new file mode 100644 index 00000000000..436bea50e83 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach.yml @@ -0,0 +1,35 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access each + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c(e).d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 8} + end: {line: 0, character: 9} +finalState: + documentContents: | + a().b.c(e).d; + selections: + - anchor: {line: 0, character: 0} + active: {line: 0, character: 3} + - anchor: {line: 0, character: 3} + active: {line: 0, character: 5} + - anchor: {line: 0, character: 5} + active: {line: 0, character: 10} + - anchor: {line: 0, character: 10} + active: {line: 0, character: 12} diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach2.yml new file mode 100644 index 00000000000..79fff2d6d88 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/typescript/takeEveryAccessEach2.yml @@ -0,0 +1,31 @@ +languageId: typescript +command: + version: 5 + spokenForm: take every access each + action: {name: setSelection} + targets: + - type: primitive + modifiers: + - type: everyScope + scopeType: {type: private.fieldAccess} + mark: {type: decoratedSymbol, symbolColor: default, character: e} + usePrePhraseSnapshot: true +spokenFormError: Scope type 'private.fieldAccess' +initialState: + documentContents: | + a().b.c(e.f).d; + selections: + - anchor: {line: 1, character: 0} + active: {line: 1, character: 0} + marks: + default.e: + start: {line: 0, character: 8} + end: {line: 0, character: 9} +finalState: + documentContents: | + a().b.c(e.f).d; + selections: + - anchor: {line: 0, character: 8} + active: {line: 0, character: 9} + - anchor: {line: 0, character: 9} + active: {line: 0, character: 11} diff --git a/queries/javascript.core.scm b/queries/javascript.core.scm index 920524256d4..6fa676b5f8c 100644 --- a/queries/javascript.core.scm +++ b/queries/javascript.core.scm @@ -1,4 +1,5 @@ ;; import javascript.function.scm +;; import javascript.fieldAccess.scm ;; `name` scope without `export` ( diff --git a/queries/javascript.fieldAccess.scm b/queries/javascript.fieldAccess.scm new file mode 100644 index 00000000000..5a0f33fc6b4 --- /dev/null +++ b/queries/javascript.fieldAccess.scm @@ -0,0 +1,105 @@ +;;!! foo.bar +;;! ^^^ +( + (member_expression + object: (_) @private.fieldAccess + ) + (#not-type? @private.fieldAccess call_expression member_expression subscript_expression) +) + +;;!! foo().bar +;;! ^^^^^ +( + (member_expression + object: (call_expression + function: (_) @dummy + ) @private.fieldAccess + ) + (#not-type? @dummy member_expression) +) + +;;!! foo[0].bar +;;! ^^^^^^ +( + (member_expression + object: (subscript_expression + object: (_) @dummy + ) @private.fieldAccess + ) + (#not-type? @dummy member_expression) +) + +;;!! foo.bar +;;! ^^^^ +( + (member_expression + [ + "." + (optional_chain) + ] @private.fieldAccess.start + property: (_) @private.fieldAccess.end + ) @dummy + (#not-parent-type? @dummy call_expression subscript_expression) +) + +;;!! foo.bar() +;;! ^^^^^^ +(call_expression + function: (member_expression + [ + "." + (optional_chain) + ] @private.fieldAccess.start + ) + arguments: (_) @private.fieldAccess.end +) + +;;!! foo.bar[0] +;;! ^^^^^^^ +(subscript_expression + object: (member_expression + [ + "." + (optional_chain) + ] @private.fieldAccess.start + ) + "]" @private.fieldAccess.end +) + +;;!! foo[bar.baz] +;;! ^^^^ +;; The reason we need this special treatment for subscript_expression is that +;; the member_expression inside the index of the subscript_expression is a +;; direct child of the subscript_expression, so will be ruled out by the +;; `foo.bar` pattern above. Note that this is not the case for `call_expression`, +;; where the arguments get their own parent node, and are thus not direct children +;; of the call_expression. +(subscript_expression + index: (member_expression + [ + "." + (optional_chain) + ] @private.fieldAccess.start + property: (_) @private.fieldAccess.end + ) +) + +;; Use the largest member_expression, call_expression, or subscript_expression +;; in a chain of such ancestors as the iteration scope. +( + [ + (member_expression) + (call_expression) + (subscript_expression) + ] @private.fieldAccess.iteration + (#not-parent-type? @private.fieldAccess.iteration member_expression call_expression subscript_expression) +) + +;; Use the interior of the `[]` in a subscript_expression as an iteration scope +(subscript_expression + index: [ + (member_expression) + (call_expression) + (subscript_expression) + ] @private.fieldAccess.iteration +) diff --git a/queries/python.fieldAccess.scm b/queries/python.fieldAccess.scm new file mode 100644 index 00000000000..56284aa6f96 --- /dev/null +++ b/queries/python.fieldAccess.scm @@ -0,0 +1,93 @@ +;;!! foo.bar +;;! ^^^ +( + (attribute + object: (_) @private.fieldAccess + ) + (#not-type? @private.fieldAccess call attribute subscript) +) + +;;!! foo().bar +;;! ^^^^^ +( + (attribute + object: (call + function: (_) @dummy + ) @private.fieldAccess + ) + (#not-type? @dummy attribute) +) + +;;!! foo[0].bar +;;! ^^^^^^ +( + (attribute + object: (subscript + value: (_) @dummy + ) @private.fieldAccess + ) + (#not-type? @dummy attribute) +) + +;;!! foo.bar +;;! ^^^^ +( + (attribute + "." @private.fieldAccess.start + attribute: (_) @private.fieldAccess.end + ) @dummy + (#not-parent-type? @dummy call subscript) +) + +;;!! foo.bar() +;;! ^^^^^^ +(call + function: (attribute + "." @private.fieldAccess.start + ) + arguments: (_) @private.fieldAccess.end +) + +;;!! foo.bar[0] +;;! ^^^^^^^ +(subscript + value: (attribute + "." @private.fieldAccess.start + ) + "]" @private.fieldAccess.end +) + +;;!! foo[bar.baz] +;;! ^^^^ +;; The reason we need this special treatment for subscript is that +;; the attribute inside the subscript of the subscript is a +;; direct child of the subscript, so will be ruled out by the +;; `foo.bar` pattern above. Note that this is not the case for `call`, +;; where the arguments get their own parent node, and are thus not direct children +;; of the call. +(subscript + subscript: (attribute + "." @private.fieldAccess.start + attribute: (_) @private.fieldAccess.end + ) +) + +;; Use the largest attribute, call, or subscript +;; in a chain of such ancestors as the iteration scope. +( + [ + (attribute) + (call) + (subscript) + ] @private.fieldAccess.iteration + (#not-parent-type? @private.fieldAccess.iteration attribute call subscript) +) + +;; Use the interior of the `[]` in a subscript as an iteration scope +(subscript + subscript: [ + (attribute) + (call) + (subscript) + ] @private.fieldAccess.iteration +) diff --git a/queries/python.scm b/queries/python.scm index 180c675a596..9703847594a 100644 --- a/queries/python.scm +++ b/queries/python.scm @@ -1,3 +1,5 @@ +;; import python.fieldAccess.scm + ;; Generated by the following command: ;; > curl https://raw.githubusercontent.com/tree-sitter/tree-sitter-python/d6210ceab11e8d812d4ab59c07c81458ec6e5184/src/node-types.json \ ;; | jq '[.[] | select(.type == "_simple_statement" or .type == "_compound_statement") | .subtypes[].type]'