razor icon indicating copy to clipboard operation
razor copied to clipboard

Implement propper commenting in blazor, please

Open vsfeedback opened this issue 1 year ago • 3 comments

This issue has been moved from a ticket on Developer Community.


You can't comment a section if you already have a comment in it. It works in c#, it doesn't in blazor. Please implement it.

@* <PropertyColumn Property="@(c => c.Description)" Align="Align.Start" Title="Description" /> <PropertyColumn Property="@(c => c.DateCreated.ToString("dd.MM.yyyy HH:mm"))" Align="Align.Start" Sortable="true" Title="Created" /> @* TODO: DATE sorting, not string. *@ <PropertyColumn Property="@(c => c.CountryCode)" Align="Align.Center" Title="Country code" /> * @


Original Comments

Feedback Bot on 1/31/2024, 09:32 PM:

(private comment, text removed)

vsfeedback avatar Jun 26 '24 16:06 vsfeedback

It works in c#

I'm afraid it doesn't: image

Single line comments work like this in C#, but Razor has no concept of single line comments.

davidwengier avatar Jun 26 '24 22:06 davidwengier

Razor has no concept of single line comments.

I guess you could do something like:

@{
//<PropertyColumn Property="@(c => c.DateCreated.ToString("dd.MM.yyyy HH:mm"))" Align="Align.Start" Sortable="true"
//Title="Created" /> @* TODO: DATE sorting, not string. *@
}

jjonescz avatar Jun 27 '24 08:06 jjonescz

It occurs to me this could be a tooling request, not a compiler one, and when they say "you can't comment a section", they could mean the actual act of commenting code.

When executing the "Toggle Block Comment" command in VS, Roslyn will handle any block comments in the span such that the result is valid: 9c395c26-fc5d-4e97-a87f-2d67968072c2

Razor, due to the VS editor handling the commenting for us, has no functionality for this, and cannot currently add it. This is potentially something we need to get the editor to look at.

EDIT: Been at Microsoft too long, used the word "ask" as a noun. Fixed.

davidwengier avatar Jun 27 '24 21:06 davidwengier