Single Quote string for Python
-
Hello, is there a way I can hack functionList so that I can have single-quoted string literals highlight in my editor? I tried (?s:\x27.*?\x27) but it doesnt seem to work. thanks!
-
I’m not sure what kind of highlighting you are looking for. The Python lexer (not the Function List) will highlight a single-quoted Python string when you type the closing single-quote, example:
-
Further to what @Scott-Sumner said: When the Python Lexer is selected (either by automatic filename-extension detection when you load a
.py
file, or by manually selecting Language > Python or Language > P > Python), if you want single-quoted literals to be highlighted differently than double-quoted, you can change the Settings > Style Configurator > Python settings: the Style: STRING will define what highlighting gets applied to"double-quoted"
strings, and Style: CHARACTER will define what highlighting gets applied to'single-quoted'
literals. By default, both those have the same color (in the “Default (stylers.xml)” theme), so if you want to distinguish those, you will have to make a change.For example, here I show what happens when you change CHARACTER foreground to RED instead of GREY:
-
Thanks! MINDBLOWN :O :O :O