Closed deathaxe closed 5 years ago
This is hard to implement properly.
Multi-line plain scalars operate on indentation alone and are terminated once a token on the same level as the starting token is found (i.e. on the same level as match
). Even if I were to omit this and start off by the indentation of the next line and terminate once I find a line with less indentation than that (which still breaks for this example), it is impossible to track both the indentation level and the regex groups levels.
Ideally, you'd just use block-style scalars for multi-line regular expressions.
However, I could see a way to only terminate a plain scalar when encountering a key or a list item on the next line. It wouldn't be entirely correct of course, but it would manage to fix this issue. Either way, considering how rarely this comes up and how small the inconvenience of having two invalid parentheses highlighted is, I'm not inclined to spend time on this.
I just realized it. It is of low priority. Wouldn't bloat or introduce too much complexity to handle this edge case.
Closing parentheses in extended patterns are highlighted as illegal even though ST accepts this kind of rule. May not be the best style, but works.