razor
razor copied to clipboard
Razor HTML Colorization Recognizing Invalid Keywords
- Create an empty
.razor
/.cshtml
file - Paste in:
<div>
do string foo something const string you know
what is going on?
</div>
Expected:
- no coloring for
do
,const
,going
Actual:
Potentially related to: https://github.com/dotnet/aspnetcore/issues/21071
Still repros.
Thank you for your reported issue. We believe this issue is fixed in the latest Visual Studio 2022. If you'd like to try this tooling out you can download the latest VS 2022 and re-try your scenario.
If this issue has been closed and you're still encountering issues feel free to respond to still communicate via the issue and we'll re-open if needed.
@NTaylorMullen I tried out this one when moving it and it looks like it still repros in the new editor
It doesn't seem to repro 100% of the time though, weird
Here is my motivating example in #4462
sample text that is not highlighted if (true)
if (true) // this is highlighted as if it was syntax, but it's text
{
<div></div>
}
else
{
<div></div>
}
@if (true) // this is actually syntax
{
<div></div>
}
else
{
<div></div>
}
And the rendering in 17.4.0 Preview 2.1
@Tragetaschen - I know, right? Spot the difference. I actually don't have the little grey dashes displayed in my editor, so there is literally no difference between C# and not C# in my case. Confuses me more times than I care to admit.
Curse you past Razor designers.. why is this allowed?

What would be so bad about requiring an @
in front of that do
????