Skip to content

Commit abb19fd

Browse files
Allow "return@" in Kotlin Tree sitter queries
1 parent 57acd6c commit abb19fd

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

packages/cursorless-engine/src/languages/TreeSitterQuery/validateQueryCaptures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ for (const captureName of captureNames) {
6060

6161
// Not a comment. ie line is not starting with `;;`
6262
// Capture starts with `@` and is followed by words and/or dots
63-
const capturePattern = new RegExp(`^(?!;;).*@([\\w.]*)`, "gm");
63+
const capturePattern = new RegExp(`^(?!;;).*@([\\w.]+)`, "gm");
6464

6565
export function validateQueryCaptures(file: string, rawQuery: string): void {
6666
const matches = rawQuery.matchAll(capturePattern);

queries/kotlin.scm

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,13 @@
437437
(_) @value
438438
) @_.domain
439439

440-
;; Disabled due to Cursorless error ("invalid capture") caused by "return@"
441-
;; (jump_expression
442-
;; "return@"
443-
;; .
444-
;; (label)
445-
;; .
446-
;; (_) @value
447-
;; ) @_.domain
440+
(jump_expression
441+
"return@"
442+
.
443+
(label)
444+
.
445+
(_) @value
446+
) @_.domain
448447

449448
(_
450449
(function_body

0 commit comments

Comments
 (0)