Editor Colors in Razor Code

Completed

I have developed a editor rich color scheme for CSHTML.  As soon as I wrap some razor code around this the entire code block it turns the color of Reshaper Razor Code Block.  This is not very helpful.  Am I missing something?   

1
6 comments

Hi! 

Could you please add some screenshots illustrating the issue? 

Thanks! 

0

Yes.  Sorry about that.

Rider  2021.1.3 

Here is just some garbage code to show the colors.   As you can see most of the color is blue.  Razorcode is how I control which menus are shown. 

Here are the settings.  As you can see there are not a lot of choices for keywords etc

0

Hi! 

Thank you for the details. Do you have the same colors in the latest Rider EAP? I'm not sure that I was able to reproduce this issue. Could you please attach a sample code file or small project? 

 

0

The EAP does not make a difference.   Same. 

Worth noting that this is a large project and when it is first colorized the colors are as set for HTML.  But then after a while the Razor colors are set and it all turns blue 

Code Sample:

<ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello User.Identity.Name!</a>
</li>
// <li class="nav-item">
// <form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new {area = ""})" method="post">
// <button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
// </form>
// </li>
}
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register in LoginPartial</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>
</ul>





0

In looking at this further the problem is that the editor colorizes the entire razor code block like it is all razor code when in fact it should be colorizing only the code that is actual razor code with the @  symbol.  It should ignore the html code and it does not. 

0

Hi! 

Thank you for the additional details, I was able to reproduce the case with the right color scheme. Indeed Rider does not ignore HTML code in razor code blocks. 

I created an issue about that: RIDER-64604. Feel free to follow it and upvote. 

Should you have any other questions, let us know. Have a nice day! 

0

Please sign in to leave a comment.