File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed
packages/cursorless-engine/src/languages/TreeSitterQuery Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ const testCases: { name: string; isOk: boolean; content: string }[] = [
51
51
isOk : true ,
52
52
content : ";; (if_statement) @unknown" ,
53
53
} ,
54
+ {
55
+ name : "@ ending string" ,
56
+ isOk : true ,
57
+ content : '"return@"' ,
58
+ } ,
54
59
{
55
60
name : "Unknown capture" ,
56
61
isOk : false ,
Original file line number Diff line number Diff line change @@ -59,8 +59,9 @@ for (const captureName of captureNames) {
59
59
}
60
60
61
61
// Not a comment. ie line is not starting with `;;`
62
+ // Not a string.
62
63
// Capture starts with `@` and is followed by words and/or dots
63
- const capturePattern = new RegExp ( ` ^(?!;;).*@([\\ w.]*)` , "gm" ) ;
64
+ const capturePattern = / ^ (? ! ; ; ) .* (?< ! " \w * ) @ ( [ \w . ] * ) / gm ;
64
65
65
66
export function validateQueryCaptures ( file : string , rawQuery : string ) : void {
66
67
const matches = rawQuery . matchAll ( capturePattern ) ;
Original file line number Diff line number Diff line change 437
437
(_) @value
438
438
) @_.domain
439
439
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
448
447
449
448
(_
450
449
(function_body
You can’t perform that action at this time.
0 commit comments