Skip to content

Syntax highlighting bug when using data interpolation in renpy.random.choice([]). #495

@Alpha-Fenrir-13

Description

@Alpha-Fenrir-13

Extension version

2.4.0

Issue description

When using interpolation in renpy.random.choice or simply using a left bracket, the syntax highlighting breaks, resulting in the following code all taking the color used for strings instead of their proper syntax colors. I have provided screenshots and code to help visualize this issue.

Scope inspector screenshots

(A screenshot to demonstrate the correct syntax highlighting of a comment before it is broken.)
Image

(A screenshot to demonstrate the breaking of syntax highlighting on the same comment when interpolation in renpy.random.choice([]) is used.)
Image

(A screenshot to demonstrate that this issue remains even if interpolation is done more than once.)
Image

(A screenshot to demonstrate that the syntax highlighting is primarily being broken by the left square bracket.)
Image

(A screenshot to demonstrate that syntax highlighting isn't being broken by the right square bracket.)
Image

Code

`
label start:

# Syntax highlighting works as normal.
$narrator(renpy.random.choice(["This is fine."]))

$Name = "Alpha Fenrir"

# Introduce data interpolation, even once, or square brackets and the syntax highlighting breaks.
#$narrator(renpy.random.choice(["Hello, I'm [Name]."]))
#$narrator(renpy.random.choice(["Hello, I'm [Name].", "Nice to meet you, I'm [Name]."]))

# It seems to be primarily broken by the left bracket ([).
#$narrator(renpy.random.choice(["["]))

# Right brackets don't break syntax highlighting.
#$narrator(renpy.random.choice(["]"]))

# This comment should be green and the return statement below should be purple, if they're orange something's wrong.

return

`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions