Skip to content

Typescript syntax highlighting breaking on certain regex following ! #806

Closed
@zajrik

Description

  • VSCode Version: 1.43.0-insider (user setup)
  • OS Version: Windows 10 pro

Steps to Reproduce:

  1. Fresh install of VSCode Insiders (Also occurring on stable)
  2. Paste the following code into a file:
class Foo {
    public foo(): boolean {
        return !/[():\w]/.test('foo');
    }

    private bar(): void {}
}

Does this issue occur when all extensions are disabled?: Yes

Funnily enough, it appears this code breaks GitHub's syntax highlighting as well.

Escaping the parens will fix syntax highlighting on the remainder of the document, but the syntax highlighting on the regular expression itself is still broken. Removing the ! and not escaping the parens fixes everything, but obviously that completely changes the meaning of the code.

Here's the example above:
image

And here's the prominent example in my code that sparked this issue:
image

The last screenshot is from stable with all my extensions, however I can confirm it appears similarly broken on a fresh insiders install with no extensions.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions