Open goldrik opened 8 months ago
Hi @goldrik , thanks for reporting this!
For clarity, can you please attach an image showing this behavior?
Yup, here's the same string, initialized as a character array, then as a string.
I don't think it is a bug that the escape characters are being highlighted in character vectors - they are explicitly being tokenized as constant.character.escape.matlab
. It is definitely incorrect, however, that they are being treated differently between char vectors and string arrays.
I am moving this issue over to the MATLAB-Language-grammar repository, because this is an issue with the grammar.
Describe the bug When initializing a raw string variable, escape characters (backslash + char) get highlighted by default. This occurs for character arrays (using single quotes), but not for strings (using double quotes).
For example, when defining a Windows path:
temp_path = '\\somedrive\path\to\right\folder\';
In this case, the escape characters\\
,\r
,\t
, and\f
characters would be highlighted.If you do the same but with double quotations, the error does not occur. This is the expected behavior.