Skip to content

Incorrect insertion of a comment in a string in VSCode #16815

@mtkennerly

Description

@mtkennerly

rust-analyzer version: 0.3.1877-standalone (574e23e 2024-03-09)

rustc version: 1.75.0 (82e1608df 2023-12-21)

relevant settings: N/A

repository link (if public, optional): N/A

code snippet to reproduce:

Regex::new("[^/]")

Place your cursor after the / and insert a *. It will expand to:

Regex::new("[^/* */]")

I don't think it should insert a comment since it's inside of a string.

Some more examples:

  • These trigger the issue:
    • Regex::new("/ ")
    • Regex::new("/]")
  • These do not:
    • Regex::new("/")
    • Regex::new(" /")
    • Regex::new("[/")

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-vscodevscode plugin issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions