Sublime Forum

Disable unclosed quote highliting

#1

How do I disable the red bar that highlights an unclosed quote? I want all other syntax highlighting to remain the same.
(Python - Syntax Specific)
sublime

0 Likes

#2

The easiest way would be give source.python invalid.illegal.unclosed-string a normal bg color.

1 Like

#4

How is this done? What file do I need to change? how do I access this setting?

0 Likes

#5

image
image

        {
            "name": "Python unclosed string",
            "scope": "source.python invalid.illegal.unclosed-string",
            "background": "var(--background)", // or your background color
        }

--background may be my own defined variable so it may not exist in your color scheme. You can hardcode any color code like #000 however.

For more information, see https://www.sublimetext.com/docs/color_schemes.html

1 Like

#6

Thank you. I’ve been searching for this for far too long.
It should also be possible to change this setting from a highlight to something like an underline, right?
I’ll read through the docs, but another hint would be greatly appreciated.

0 Likes

#7
        {
            "name": "Python unclosed string",
            "scope": "source.python invalid.illegal.unclosed-string",
            "background": "var(--background)", // or your background color
            "font_style": "underline",
        }

https://www.sublimetext.com/docs/color_schemes.html#font_style

1 Like

#8

Per the docs:

The contents of the "variables" and "globals" keys are merged, with the user’s copy overwriting keys with the same name. For the "rules" array, the user’s rules are appended.

I have added the following to my Mariana color-scheme:

"rules":
[
    {
        "name": "Python unclosed string",
        "scope": "invalid.illegal.unclosed-string.python",
        "background": "none",
    }
]

The problem is that for this scope, the background applies to the area after the text (see the image at the top of this thread). So, settings like ‘foreground’ or ‘font_style’ do nothing because there is no font to adjust. Further, deleting the ‘background’ line does not do anything, because (if I understand it right) this user-defined rule is appended to the existing rule, which still has the ‘background’ statement.
This seems terribly hacky, but using “none” has eliminated that godawful orange highlight bar. That’s good enough for now.

What I would really like to see is quotes treated the same as brackets via the package BracketHighlighter. If you have any tips there, I’d really appreciate it; if not, no worries.

Thank you for your help

0 Likes

#9

A stray quote doesn’t have a special scope so that’s not possible to do anything with its scope.
image

0 Likes

#10

Understood.
Ok, thank you for taking the time @jfcherng
I was tearing my hair out for a while there.

0 Likes