Skip to content

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

@tn-5

Description

@tn-5

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 WeatherForecast as a class/type

Add nullable field

  • Add string? test; before the WeatherForecast declaration
  • Observe that the highlighting of WeatherForecast is still correct

Add nullable property

  • Add string? test1 {get; set;} before the WeatherForecast declaration
  • Observe that the highlighting of WeatherForecastnow reverts to generic text

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions