Skip to content

Commit 9cec9f0

Browse files
Support tagged templates strings in JavaScript (#2769)
Fixes #646 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] 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) - [/] I have not broken the cheatsheet
1 parent 655f611 commit 9cec9f0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
taggedTemplate`hello ${world}`
2+
---
3+
4+
[Content] =
5+
[Removal] =
6+
[Domain] = 0:0-0:15
7+
>---------------<
8+
0| taggedTemplate`hello ${world}`
9+
10+
[Insertion delimiter] = " "

packages/common/src/scopeSupportFacets/javascript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const javascriptCoreScopeSupport: LanguageScopeSupportFacetMap = {
1212
switchStatementSubject: supported,
1313
fieldAccess: supported,
1414
disqualifyDelimiter: supported,
15+
pairDelimiter: supported,
1516

1617
"textFragment.string.singleLine": supported,
1718
"textFragment.string.multiLine": supported,

queries/javascript.core.scm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,16 @@
454454
(template_string)
455455
] @string
456456

457+
;; taggedTemplate`hello ${world}`
458+
;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
459+
(call_expression
460+
function: (_) @pairDelimiter.start
461+
arguments: (template_string
462+
.
463+
"`" @pairDelimiter.end
464+
)
465+
)
466+
457467
;;!! // comment
458468
;;! ^^^^^^^^^^
459469
(comment) @comment

0 commit comments

Comments
 (0)