Sublime Forum

Match multiple lines in .sublime-syntax

#1

Hi,

There are instances where I need to check the pattern before highlighting it and it could be across multiple lines, could a switch be added to allow specific matches to go through multiple lines?

The regex shown in the link would work in both cases if multiline was enabled as the syntax differentiate arrow functions from expression groups:

I know that there would be performance implications and that’s why I am suggesting a switch on the regex that would be off by default, most syntaxes would benefit from this feature.

Sorry if this was suggested before.

0 Likes

#2

This is exactly the things that is not possible and also unlikely to change, for performance reasons. Your only chances are guessing or recovering.

For guessing, you would assume that any opening paren followed by a line break starts a lambda. This will, however, not be optiomal and result in false positives.
For recovering, you could always match the arrow and the opening braces (by not requiring parameters before), but you wouldn’t be able to match the parameters.

2 Likes

#3

May be related to:

  1. #1412 A native to apply a scope give a chunk of text
0 Likes

Syntax for multi line ifs not supported?