Sublime Forum

Nested application of color scheme styles?

#1

Many editors, especially ones made for newer coders, have this feature where scopes get a color, that gets darker as it is nested. I hoped this would be possible in sublime by using this rule in my color-scheme

{
    "name": "nestedScopeHighlighting",
    "scope": "meta.block",
    "background": "rgba(0, 0, 0, 0.05)"
},

Code like this would then get progressively slightly darker as the nesting gets deeper


if (10 == 10) {
    while (shouldContinueLooping()) {
        if (somethingChanged) {
           // bla
        } else {
           // bla 
        }
    }
}

In a php file I have, for instance, the scope looks like this

embedding.php
text.html.basic
meta.embedded.block.php
source.php
meta.function.php
meta.block.php
meta.function-call.php
meta.group.php
meta.function.php
meta.block.php
meta.function-call.php
meta.group.php
meta.function.php
meta.block.php

Note the nested meta.block.php scopes.

What actually happens, is that color is set and not added to the scope.

0 Likes

#2

no, this is not possible as it is not how scope selector matching in color schemes work. You can always add rules for meta.block meta.block etc.

1 Like

#3


1 Like

#4

Oohh interesting, that workaround is perfectly sufficient for me :smiley:

0 Likes