-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Allow comment lines in middle of a multi-line statement #501
Comments
My thoughts about that is, maybe hard to implement my personal opinion, Has currently comments are allowed after implicit / explicit line-continuations, we have to remember what construct we were parsing before and continue afterwards. This could clash if the two line before and after can me interpreted as two legally separate statements. |
@AdamSpeight2008 |
Note: this woudl likely be a very large impact to the IDE. Any proposal/work here will need to appropriately cost that in. |
You can do this now in VB16, the formatting is just not pretty. services.AddControllersWithViews().
_ ' Enable Vazor
AddRazorRuntimeCompilation(
Sub(options) options.FileProviders.Add(
New Vazor.VazorViewProvider())
) |
Thanks for pointing that out, I agree it's not pretty, but it's still less ugly than the alternatives. Call me old fashioned, but I'm not mad about 'fluent' construction of objects, but some libraries don't offer an alternative, and this could come in handy for explaining in the middle of a fluent construction. |
I like it 👍 |
The problem is the formatter always puts the _ in position 2 on an comment only line. services.AddControllersWithViews(). _ ' Enable Vazor
_ ' You can do this, any number of spaces are allowed after the _ and
_ ' before the ' but its manual. GitHub doesn't understand it but the 3 comment lines up
_ ' and new lines align back at the beginning
AddRazorRuntimeCompilation(
Sub(options) options.FileProviders.Add( _ ' This is also allowed
New Vazor.VazorViewProvider()) ' and this
) The formatter just doesn't understand _ ' Comment |
@CyrusNajmabadi |
@VBAndCs prs welcome. In general, we would ask that any of these language features come with the respective ide work for them as well to be actually complete. |
@CyrusNajmabadi when I did I the formatter was being updated and was to include this but it never happened. Supporting this was too low a priority since no one was using it yet to delay other formatting improvements. Its one of the reason other VB features don't happen that were originally planned. VB support is not a gate for a release. |
I consider this a higher priority as we want the core experience around these features (including formatting) to be at an acceptable level :-) |
@CyrusNajmabadi thanks, There is a design question on how to handle the spaces best. Below are just a few possible options. The parser will accept any of them.
|
Today, I wrote this in a VB.NET ASP.NET Core app:
but I got syntax error, because the comment in the second line!
The only allowed syntax today is:
I propose to accept comment line/lines in middle of a multi-line statement. I think it t shouldn't be that hard.
Note:
This proposals is not for VB.NET team, but for the community that will continue to evolve the language. I started today to trace VB compiler code by debugging its tests. I hope I find my way through the source so I can implement my suggestions myself.
The text was updated successfully, but these errors were encountered: