renpy / vscode-language-renpy

Ren'Py extension for Visual Studio Code
Other
106 stars 22 forks source link

Wrong syntax highlighting for lists of strings (with substitution) #435

Closed Mondprinzessin closed 3 months ago

Mondprinzessin commented 3 months ago

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]"]
duckdoom4 commented 3 months ago

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