Skip to content

Complex string incorrectly highlights as quoted symbol #449

@matthewd

Description

@matthewd

Given:

puts("a#{":b"}c")

The inner ": sequence pairs with the opening quote, making a part of a quoted symbol hash key. The #{..} subexpression itself still highlights correctly, but c is not part of any quoted construct (and consequently the closing quote instead starts a new string, messing up the rest of the file).

This feels like it might be unsolvably edge-casey, but I'm regularly astounded by how well this syntax handles very questionable code, so I figured it's at least worth reporting. 🤷🏻‍♂️

I encountered this pattern in the wild in this file: https://github.com/rails/rails/blob/40272988cec849c734ec02cfa89ff830ae019d9e/actionpack/lib/action_controller/metal/strong_parameters.rb#L51

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions