Feature Request - Line comments for multi-line statements in VB.NET - by Alex Essilfie

Status : 

  Other<br /><br />
		This item had a custom resolution.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 677378 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 6/28/2011 2:03:22 PM
Access Restriction Public



I've been using VS2010 for almost a year and I believe it is the best IDE so far.
Being a VB.NET developer, I find the implicit line continuation feature introduced in VS2010 very useful, especially when writing LINQ statements. One thing that bothers me is that I'm not able to write comments next to each line to detail my team members on what exactly a particular line is doing.

Consider for instance the following:

Dim var = From r in DataTable.Rows.OfType(Of DataRow)()
                Select value = r(1).ToString & " some arbitrary operation"
                Where Not String.IsNullOrEmpty(value)

In a number of cases, I'd like to place a comment next to the second line (Select value = .....) to describe the purpose of that line so that the code looks like this:

Dim var = From r in DataTable.Rows.OfType(Of DataRow)()
                Select value = r(1).ToString & " some arbitrary operation"   ' this is a sample comment for demonstration
                Where Not String.IsNullOrEmpty(value)

Unfortunately, this is not possible because the compiler interprets any code that comes after a comment in multi-line statements as a new statement.

I think allowing us (VB.NET developers) to write comments in multi-line statements would be a welcome feature in the next version of Visual Studio.

Thanks a lot.
Sign in to post a comment.
Posted by Microsoft on 7/29/2011 at 6:55 PM
Hi Alex. I hate this limitation too.

The bad news is that the VB parser is built from the ground up with hard-coded assumptions about line-breaks and comments. We'd have to throw it away and start again from scratch if we wanted to fix this.

The good news is that we do plan on rebuilding the parser from scratch, under the codename "Roslyn" (there have been a few talks and demos and articles about it). We do aim to get this particular feature into the Roslyn parser. At the moment, though, it's still a long way off, and we're not making any commitments or announcements yet.

Lucian Wischik, VB language PM
Posted by Microsoft on 6/28/2011 at 2:12 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)