From 897063780fb0cf2ba44e316b5423aa2083346a5d Mon Sep 17 00:00:00 2001 From: James Stout Date: Mon, 14 Oct 2024 23:06:29 -0700 Subject: [PATCH] Added tests for recently-fixed Kotlin functionality. (#2668) Added tests for #2642 ## Checklist - [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 --- .../recorded/languages/kotlin/changeCall5.yml | 33 +++++++++++++++++++ .../languages/kotlin/changeValue13.yml | 31 +++++++++++++++++ queries/kotlin.scm | 1 - 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 data/fixtures/recorded/languages/kotlin/changeCall5.yml create mode 100644 data/fixtures/recorded/languages/kotlin/changeValue13.yml diff --git a/data/fixtures/recorded/languages/kotlin/changeCall5.yml b/data/fixtures/recorded/languages/kotlin/changeCall5.yml new file mode 100644 index 0000000000..81ff62b2b9 --- /dev/null +++ b/data/fixtures/recorded/languages/kotlin/changeCall5.yml @@ -0,0 +1,33 @@ +languageId: kotlin +command: + version: 7 + spokenForm: change call + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: functionCall} + usePrePhraseSnapshot: true +initialState: + documentContents: |- + fun main() { + val s = "test" + val l = with (s) { length } + println(l) + } + selections: + - anchor: {line: 2, character: 14} + active: {line: 2, character: 14} + marks: {} +finalState: + documentContents: |- + fun main() { + val s = "test" + val l = + println(l) + } + selections: + - anchor: {line: 2, character: 12} + active: {line: 2, character: 12} diff --git a/data/fixtures/recorded/languages/kotlin/changeValue13.yml b/data/fixtures/recorded/languages/kotlin/changeValue13.yml new file mode 100644 index 0000000000..f86d7e0948 --- /dev/null +++ b/data/fixtures/recorded/languages/kotlin/changeValue13.yml @@ -0,0 +1,31 @@ +languageId: kotlin +command: + version: 7 + spokenForm: change value + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - type: containingScope + scopeType: {type: value} + usePrePhraseSnapshot: true +initialState: + documentContents: |- + fun main() { + val n = null + println(n) + } + selections: + - anchor: {line: 1, character: 8} + active: {line: 1, character: 8} + marks: {} +finalState: + documentContents: |- + fun main() { + val n = + println(n) + } + selections: + - anchor: {line: 1, character: 12} + active: {line: 1, character: 12} diff --git a/queries/kotlin.scm b/queries/kotlin.scm index 3578b229ff..6375eb9067 100644 --- a/queries/kotlin.scm +++ b/queries/kotlin.scm @@ -509,7 +509,6 @@ (annotated_lambda) @argumentOrParameter ) -;; Note: trailing lambda mixed with regular arguments doesn't work due to bad tree sitter parse. (call_expression (call_suffix) @argumentOrParameter.iteration ) @argumentOrParameter.iteration.domain