cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.09k stars 77 forks source link

Fix typescript text fragments when there is an escape sequence #2393

Open pokey opened 1 month ago

pokey commented 1 month ago

In the following code:

"hello\nworld"

textFragment currently looks like:

image

We should have one text fragment for the entire inside of the string

Here's parse tree:

(string
    """
    (string_fragment)
    (escape_sequence)
    (string_fragment)
    """
)

should be easy with range

Though we need to be a bit careful because we don't want to eat interpolations, only escape sequences. Although I wonder how we can support

`aaa (bbb ${ccc} ddd) eee`

I would expect "take round" to work from bbb. Probably also from ccc, tho I could see a case against that as we're in a syntactic region so might not want text-based pairs to match