razor icon indicating copy to clipboard operation
razor copied to clipboard

Razor HTML Colorization Recognizing Invalid Keywords

Open TanayParikh opened this issue 4 years ago • 5 comments

  1. Create an empty .razor/.cshtml file
  2. Paste in:
<div>
    do string foo something const string you know
    what is going on?
</div>

Expected:

  • no coloring for do, const, going

Actual: image

colors

TanayParikh avatar May 19 '20 17:05 TanayParikh

Potentially related to: https://github.com/dotnet/aspnetcore/issues/21071

TanayParikh avatar May 19 '20 17:05 TanayParikh

Still repros.

ryanbrandenburg avatar Oct 16 '20 22:10 ryanbrandenburg

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 avatar Oct 05 '21 19:10 NTaylorMullen

@NTaylorMullen I tried out this one when moving it and it looks like it still repros in the new editor

allisonchou avatar Oct 05 '21 19:10 allisonchou

image

It doesn't seem to repro 100% of the time though, weird

allisonchou avatar Oct 05 '21 19:10 allisonchou

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

image

Tragetaschen avatar Oct 22 '22 21:10 Tragetaschen

@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.

Bellarmine-Head avatar Oct 24 '22 13:10 Bellarmine-Head

Curse you past Razor designers.. why is this allowed?

image

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

davidwengier avatar Nov 22 '22 05:11 davidwengier