Home > Net >  How do I get my Angular text Colorized in Visual Studio 2022?
How do I get my Angular text Colorized in Visual Studio 2022?

Time:03-11

This is a strange issue, but likely an easy one for someone who has done it before.

I just installed Visual Studio 2022. Opening a file, I immediately noticed that my Angular code is no longer purple on my .cshtml pages.

This was super helpful in Visual Studio 2019.

Here's what it used to look like in VS 2019...

enter image description here

And here's what it looks like in VS 2022...

enter image description here

I have ReSharper, but it's installed in both and I'm not even sure that's where this is coming from.

I'm fairly certain I installed all the same (or similar) extensions, but still can't figure out what is doing this.

I'd love to have my purple code colors back!

Any help, greatly appreciated!

CodePudding user response:

This is a product regression, there's a feedback item open here.

The longer story is that it's related to the new Razor editor in VS2022. The legacy editor would highlight these somewhat blindly, because they do slightly different things in different front-end frameworks, but the syntax was largely consistent. The new editor doesn't (yet) do that.

Until the issue is fixed, you can change back to the legacy editor following the instructions here but you'll miss out on any new features being added for Razor development.

CodePudding user response:

This is just the colour theme you're using, some will highlight inside the brackets and some won't. To change the theme open the command palette with ctrl shift p and find Preferences: Color Theme. Or use the shortcut ctrl k, ctrl t.

I'm using Dark myself and it highlights these in blue, whereas the regular dark theme does not. If I remember right, ReSharper has some custom themes as well.

Preview themes with the up and down arrow keys. There is an option at the top to browse the marketplace as well. The only one where these are purple (maybe more pink) that I see is called SynthWave '84 by Robb Owen.

You can also search for themes in the extensions tab with @category:"themes", or in the browser here: https://marketplace.visualstudio.com/search?target=vscode&category=Themes

You could always make your own theme but I've never tried it myself, so I don't know how difficult it is. Easiest thing would be to fork one you like and figure out how to change it to your liking.

  • Related