Omnisharp-vscode: VS Code not picking up HTML tags after Razor code

Created on 11 Oct 2018  路  13Comments  路  Source: OmniSharp/omnisharp-vscode

Issue Type: Bug

I was told by the VS Code GitHub that this is an issue with this extension.

Take a look at the screenshot. You can see <li> tags with a razor action link and then the closing <li> tags after that are not being picked up afterwards.

vs-code_razor

I'm assuming this can easily be reproduced by creating a razor file and then creating an unordered list as shown in the screenshot. This is happening with @Html.ActionLink() as well as @RenderSection and looks like it happens anytime razor code is used at all.

Razor

All 13 comments

cc @NTaylorMullen

@DanJ210 could you re-upload the screenshot? It's a deadlink on my end (can't see it).

@NTaylorMullen You're right, sorry. I updated above so now it should show up. If you'd like a full screen screenshot I can do that as well. But what you see is happening on every line that there's Razor and in VS Code the file code is selected as Razor.

Ahhh, thanks for the update and the issue report @DanJ210. This is a frustrating issue but thankfully known! We've started developing the Razor support for VSCode over in https://github.com/aspnet/Razor.VSCode and plan to fix a duplicate issue to this in our Alpha 2 release.

Granted the Alpha 2 release is around 2+ months away so It might be a bit until this bug is fixed 馃槃

No problem at all.

Hello, guys

image

Is this the same issue?

@timramone You're talking about the red text after the area that you're pointing to? The area you're pointing took looks fine. It's the code after that's being rendered in red, correct?

No, highlighting here is definitedly incorrect. @( syntax starts C# parsing till next ) symbol, which is in the end of the string. Visual Studio btw has correct highlighting:

image

It understands that string after @ is a C# syntax part.

Yup, that's the same as https://github.com/aspnet/Razor.VSCode/issues/75.

Sadly VSCode's primary coloring mechanism lies in a regex grammar. Today the Razor experience uses the one provided out of the box by VSCode. We need to update that grammar to actually reflect the various flavors of a Razor document

This is actually very sad news :(
But thanks anyway :)

So do you have a suggestion to what I should do, @NTaylorMullen? I've got entire Razor views being rendered in plain colored text so it's harder to follow. Is there a work around I can do? Another file type I should use? Or just go back to Visual Studio until the grammar gets reworked?

So do you have a suggestion to what I should do, @NTaylorMullen? I've got entire Razor views being rendered in plain colored text so it's harder to follow. Is there a work around I can do? Another file type I should use? Or just go back to Visual Studio until the grammar gets reworked?

Totally understand the frustration. if you wanted you could change the Razor code to do all of the double quoted work inside of an @{...}, save to a variable and then render the variable. Otherwise, your best bet would be to hop over to Visual Studio until we've had a chance to address the grammar issues.

Ok. Well I appreciate the work you all do and I can't wait for a solution.

Thanks for the advice.

Was this page helpful?
0 / 5 - 0 ratings