Search code examples
visual-studioasp.net-corerazorvisual-studio-2022

Is it possible to setup Razor code highlights in Visual Studio 2022 to match Visual Studio 2019


VS2022 version: 17.5.1

Trying to move to VS2022, and I've noticed that the razor syntax highlighting has changed (imo for the worse). I'm wondering if it's possible to move back to the way it was in 2019?

Specifically, Razor bits in 2019 were marked differently than surrounding areas with a silver background and their own text colour. In VS2022 it seems to only differentiate via the @ symbol, and worst of all, takes on the text colour of surrounding blocks (see below for the razor code inside of a string).

I've tried the font colours option - specifically, the Razor Code Background setting, which isn't present in my options in VS2019. However, when I change it (again, in VS2022), it updates the way Razor is displayed in VS2019, while ignoring it in VS2022!!!

VS2019:

enter image description here

VS2022:

enter image description here


Solution

  • Thankfully, this has now been fixed as of Visual Studio 17.8+. You can now change this setting under Tools/Options/Text Editor/Razor/Advanced enter image description here