PersistentRegexHighlight icon indicating copy to clipboard operation
PersistentRegexHighlight copied to clipboard

not able to define complex "color_scope"

Open MattDMo opened this issue 11 years ago • 1 comments

Hi Scott, I was going back over some old questions of mine, and found this answer of yours about underlining in Sublime. I used the settings you suggested (slightly modified to add true and false, and they worked, except the words were highlighted everywhere, including comments, strings, etc.:

persistentregexhighlight

So, I changed the "regex" to the following:

"regex": [{
    //"pattern": "(True|true|False|false)",
    "pattern_scope": "constant.language -comment -string",
    "color_scope": "constant.language",
    "underline": true
}],

but no luck - ([Tt]rue|[Ff]alse) still get underlined everywhere. I'd only like them to be underlined where the word itself actually appears in red. Is that doable? sublime.View.scope_name() should be useful, or you could try to parse a full "pattern_scope" string.

No big rush on this, just wondering if it can be done.

Thanks! Matt

BTW, this is using version 2.0.2 on XP. I haven't tried any other platforms, or ST3, but there's no reason to think it would be different, is there?

MattDMo avatar Oct 22 '13 17:10 MattDMo

I can probably do it. As it is right now, pattern and pattern_scope are exclusive operations. Though you're right, if they are both there, I should use both.

skuroda avatar Oct 23 '13 03:10 skuroda