dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
500 stars 191 forks source link

Razor TextMate grammar does not handle nullability well in @code blocks #4472

Closed tn-5 closed 1 year ago

tn-5 commented 4 years ago

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

Add nullable field

Add nullable property

It does not seem to make any difference if the setting on the project file is enabled or not.

ChristopherHaws commented 4 years ago

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: image

NTaylorMullen commented 3 years ago

@JoeRobich does O#'s C# grammar support this in VSCode?

JoeRobich commented 3 years ago

No the C# textmate grammar is still quite a bit behind. We would recommend enabling Semantic Highlighting.

JoeRobich commented 3 years ago

@tn-5 Could you open an issue against https://github.com/dotnet/csharp-tmLanguage?

marinasundstrom commented 3 years ago

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.

AxelBrinck commented 2 years ago

I also have this issue :(

zeekbrown commented 2 years ago

I am also having this issue as well.

ryanbrandenburg commented 2 years ago

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.