cursorless
cursorless copied to clipboard
Unable to use "@" in string literals within .scm files
I bumped into this while working on Kotlin support. Here is what triggered it:
(jump_expression
"return@"
.
(label)
.
(_) @value
) @_.domain
This triggers an "invalid capture" error within Cursorless. The problematic code is here: https://github.com/cursorless-dev/cursorless/blob/4eca0350da10c2052930aa5c6eb2e09faee0e949/packages/cursorless-engine/src/languages/TreeSitterQuery/validateQueryCaptures.ts#L61-L86
ChatGPT suggests the following regex to fix this, which looks like it might actually work:
^(?!;;)(?:[^'"]|"[^"]*"|'[^']*')*?@([\\w.]*)