Skip to content

TS syntax highlighting messed up in VS2022 after update to 17.5.x #53054

Description

@jbertagnolli

Bug Report

After taking the VS2022 update 17.5.0 on 2/28/2023, syntax highlighting in Typescript became wonky. The issue is still present after taking the 17.5.1 update today (3/1/2023). My coworker who didn't take the 17.5.1 update was able to rollback to 17.4.x to confirm that everything works fine there.

Steps to reproduce:

  1. Create an empty *.ts file
  2. Open the file in Visual Studio 2022 v17.5.0+
  3. Copy the code below into the contents of your new .ts file
export class MyClass {
    public myProperty: any;

    constructor() {
        let myVar = <string>this.myProperty;

        //some comments
        //some more comments
        //ya ya

        for (let i = 0; i < 100; i++) {
            console.log(i.toString());
        }
    }
}

Notice incorrect syntax highlighting here:
2023-03-01 13_45_30-test-ts-highlight - Microsoft Visual Studio

But if I change let myVar = <string>this.myProperty; to let myVar = this.myProperty;, the issue goes away:

2023-03-01 13_45_42-test-ts-highlight - Microsoft Visual Studio

🔎 Search Terms

visual studio, 17.5.0, 17.5.1, typescript syntax highlighting

🕗 Version & Regression Information

Issue exists in Visual Studio versions 17.5.0 and 17.5.1 but not 17.4.4.

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: typescript@next
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

^I just tried this with the same issue.

  • This changed between versions 17.4.4 and 17.5.0

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.Visual StudioIntegration with Visual Studio

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions