diff --git a/cursorless-talon/src/cheatsheet/get_list.py b/cursorless-talon/src/cheatsheet/get_list.py index 001feaa1cc..f60696bb9b 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 4c51b7c3a4..aa49b5dc47 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 16d53205f5..d2ff43da35 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 799aa47e85..ccc45f19ed 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 88852cc14c..06f10b91d1 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 59452aa775..9cda195b59 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 0000000000..4b98fd0b05 --- /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 0000000000..8d788acd33 --- /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 0000000000..49bafcd209 --- /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 0000000000..0632a701c2 --- /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 0000000000..becce34a70 --- /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 0000000000..b35b7656a4 --- /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 0000000000..5ecea40d2b --- /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 0000000000..1b4121234a --- /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 0000000000..8099913a3a --- /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 0000000000..acf32cdebc --- /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 0000000000..15bfd18e0f --- /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 0000000000..b98a509d43 --- /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 0000000000..00c75f2f27 --- /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 0000000000..42bb5aedc9 --- /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 0000000000..6918a185fb --- /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 0000000000..a2410c06fb --- /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 0000000000..d23f897cac --- /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 0000000000..cf8581063e --- /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 0000000000..d82f52ab12 --- /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 0000000000..627f54fe33 --- /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 0000000000..a4f0a028f2 --- /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 0000000000..911286cbdf --- /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 0000000000..3a95625e03 --- /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 0000000000..c7b408ba6c --- /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 0000000000..a9deceb536 --- /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 0000000000..99a14bfa7d --- /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 0000000000..4f7124d3cc --- /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 0000000000..ca8858e530 --- /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 0000000000..272a33731d --- /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 0000000000..7455ffcb2f --- /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 0000000000..960653badb --- /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 0000000000..8b51354984 --- /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 0000000000..ae4fe1ab38 --- /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 0000000000..ec3d5b8b56 --- /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 0000000000..6806548f42 --- /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 0000000000..311fe3475e --- /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 0000000000..0b4df7cba3 --- /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 0000000000..dbc36d4a5d --- /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 0000000000..905de811cc --- /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 0000000000..c83d3de18a --- /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 0000000000..0fb01ad164 --- /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 0000000000..ee2c321c9c --- /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 0000000000..345af57396 --- /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 0000000000..9e2716cd6d --- /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 0000000000..5c11e3c3c0 --- /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 0000000000..08b8531457 --- /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 0000000000..d9dab15eb0 --- /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 0000000000..fdf7fe9f8b --- /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 0000000000..f6c29dd04f --- /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 0000000000..a86fe8773b --- /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 0000000000..16d60e6b7b --- /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 0000000000..436bea50e8 --- /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 0000000000..79fff2d6d8 --- /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 920524256d..6fa676b5f8 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 0000000000..5a0f33fc6b --- /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 0000000000..56284aa6f9 --- /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 180c675a59..9703847594 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]'