Sublime Forum

Scope boolean logic

#1

Some time ago (basically when I discovered overriding color schemes), I started doing something like FichteFoll’s comment here to highlight embedded syntaxes.

Fichte said that they use source source, text source, source text to tweak the color scheme for nested scopes. Looking at it again, I started to wonder whether there’s a terser way with logical operators to write the same thing: (text | source) (text | source). (This becomes more important if you want to style a third level of nesting.)

But doing that affects the whole file, not just the embeds. What am I doing wrong?

1 Like

Logical operators in selectors in sublime-syntax
#2

I have always figured that a parenthesized expression has to be followed by an operator, not by another expression directly, which would mean one can’t use your concise solution

1 Like

#3

Yes, afaik this is not possible at the moment, though I would like an update like this.

For this level highlighting you need to consider that many embeds add their own source score to the embed region in addition to the original scope of the pushed Syntax, meaning you’d end up with three scope or text scopes despite only nesting once. I created an issue for that a few days ago.

0 Likes

#4

I don’t watch the Core issues tracker, so I hadn’t seen issue #2482, which I think is the one you referred to. It’s amusing to me that the same week as you posted it, I was tinkering with the small syntax I maintain for exactly the same reason.

0 Likes