Closed phyllisstein closed 6 years ago
Also added some changes to add TypeScript to the embedded syntaxes and fix the end-of-block matching. To the best of my knowledge, using \1
in the end
regex would only create a backref to that expression; there's no way to reach through to recover the begin
pattern's matches. The change in 5795ddd is, comparatively, way less clever and more naïve, but it works:
Looks good. Just one small thing:
To the best of my knowledge, using
\1
in theend
regex would only create a backref to that expression; there's no way to reach through to recover thebegin
pattern's matches
There is, and that's how the TextMate highlighting system implements features like heredocs and Markdown code-fences. Sharing of capturing groups is somewhat of a "magic feature" that's limited to begin
/end
pairs only.
The capture it's back-referencing is the leading indentation of the beginning match; which is how we're able to nest one indented component inside a larger indented component.
But everything else looks good!
Gotcha! TMYK🌠. Shall I back that commit out, then, and play with the regexes a bit more? It definitely wasn't matching as expected, but that's arguably a problem for another PR.
Probably better to leave it for a different PR, I'd say.
👍 Duly dropped! I'll see if I can sort through the regex issue this weekend. Thanks for the feedback!
I'll hold off on cutting a release until you get back to me. =)
Hey, @phyllisstein, how did you go with tackling the other half of this PR?
I'd like to get another release cut sometime soon-ish, and it'd be great if we could get this fix on-board too.
I'm so sorry for not getting back to you sooner. I'm actually not able to reproduce the issue with end
captures in a recent build of Atom---could it be that they fixed something on their end while I was lollygagging?
Kind of an edge case, but including TypeScript snippets with tagged template literals previously broke the highlighting, causing everything in the file after the closing
`
to be treated as a link title. This slightly more conservative match seems to cover the most common way links are used without matching them promiscuously across lines.Before
After