renpy/vscode-language-renpy

Wrong syntax highlighting for lists of strings (with substitution)

Mondprinzessin opened this issue · 1 comments

Extension version

2.4.0

Issue description

When a list is defined which contains a string and this string includes string substitution like syntax the hilighting mismatches the brackets.
Imo there are two possible fixes:
a) the substitution highlighting should not be activated here, because RenPy doesn't support it.
b) or the matching of the brackets should just be fixed, because some people might want to loop over a list like this and call renpy.substitutions.substitute on these list items to trigger the substitution

Scope inspector screenshots

image

Code

default name1="foo"
default name2="bar"
default names=list(["[name1]","[name2]"])

label start:
    $ my_list = ["[name1]"]

Ha, interesting. I thought I had resolved this issue a long time ago.

I'll take a look when I find some time.

Thanks for the bug report!

Edit, ah actually, this is python code which uses the python highlighter. Seems they have a bug in their implementation (that we import locally). I'll get it fixed by overwriting it with the version from the renpy highlighter source