VSCode Razor highlighting does not handle nullability well in @code blocks
As soon as a property is declared that is of a nullable type, i.e. ? suffix, the syntax highlighting of the rest of the file seems to get confused.
Reproduce
- Generate standard template project:
dotnet new blazorserver - Open in VS Code
- Open FetchData.razor
- Observe syntax highlighting correctly highlights
WeatherForecastas a class/type
Add nullable field
- Add
string? test;before theWeatherForecastdeclaration - Observe that the highlighting of
WeatherForecastis still correct
Add nullable property
- Add
string? test1 {get; set;}before theWeatherForecastdeclaration - Observe that the highlighting of
WeatherForecastnow reverts to generic text
It does not seem to make any difference if the
I've had to turn off the new Language Services because this has made my tooling completely unusable. I was having to code blind and see if there were errors via build which is no fun.
This project builds successfully but the razor tools break at the ? on line 19:

@JoeRobich does O#'s C# grammar support this in VSCode?
No the C# textmate grammar is still quite a bit behind. We would recommend enabling Semantic Highlighting.
@tn-5 Could you open an issue against https://github.com/dotnet/csharp-tmLanguage?
Good. I also noticed this recently. I think the nullable feature needs some more love in the toolchain if it is gonna be widely adopted.
I also have this issue :(
I am also having this issue as well.
A note since it seems to have been lost, the issue was filed against csharp-tmLanguage as https://github.com/dotnet/csharp-tmLanguage/issues/191.