From 41b2e63f164140ffbf3010d4567a700699f373b9 Mon Sep 17 00:00:00 2001 From: Nathan Heffley Date: Tue, 31 Oct 2023 16:14:54 -0400 Subject: [PATCH] Move named functions to scm --- .../cursorless-engine/src/languages/php.ts | 9 ----- .../recorded/languages/php/changeFunk2.yml | 38 +++++++++++++++++++ .../recorded/languages/php/changeFunk3.yml | 31 +++++++++++++++ .../recorded/languages/php/changeFunk4.yml | 29 ++++++++++++++ .../recorded/languages/php/chuckFunk.yml | 16 +++++--- .../recorded/languages/php/chuckFunk2.yml | 23 ++++++----- queries/php.scm | 17 +++++++++ 7 files changed, 139 insertions(+), 24 deletions(-) create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk2.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk3.yml create mode 100644 packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk4.yml diff --git a/packages/cursorless-engine/src/languages/php.ts b/packages/cursorless-engine/src/languages/php.ts index e68bfa110b..9a19538108 100644 --- a/packages/cursorless-engine/src/languages/php.ts +++ b/packages/cursorless-engine/src/languages/php.ts @@ -74,15 +74,6 @@ const nodeMatchers: Partial< matcher(patternFinder("cast_expression[type]"), castTypeExtractor), ), - namedFunction: trailingMatcher( - [ - "function_definition", - "assignment_expression.anonymous_function_creation_expression", - "assignment_expression.arrow_function", - ], - [";"], - ), - value: leadingMatcher( [ "array_element_initializer[1]", diff --git a/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk2.yml b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk2.yml new file mode 100644 index 0000000000..95170090e1 --- /dev/null +++ b/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/php/changeFunk2.yml @@ -0,0 +1,38 @@ +languageId: php +command: + version: 6 + spokenForm: change funk + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: namedFunction} + usePrePhraseSnapshot: true +initialState: + documentContents: |- + 'Hello world'; + selections: + - anchor: {line: 2, character: 24} + active: {line: 2, character: 24} + marks: {} +finalState: + documentContents: | + 'Hello world'; + $myFunk = fn() => 'Hello world'; selections: - - anchor: {line: 2, character: 25} - active: {line: 2, character: 25} + - anchor: {line: 2, character: 24} + active: {line: 2, character: 24} marks: {} finalState: documentContents: |+