dotnet / vblang

The home for design of the Visual Basic .NET programming language and runtime library.
288 stars 66 forks source link

Allow assigning property value after implements #399

Open VBAndCs opened 5 years ago

VBAndCs commented 5 years ago

Assign property value after implements

If we assign an initial multi-line value to a property that implements some interface, the result will be as shown in the picture:

2

This is obviously a bad and confusing format, so I suggest to allow assigning the value after the implemnts part:

3

This is bitter, but still have a problem in formatting the multi-line string, which I suggested to solve by adding indent https://github.com/dotnet/roslyn/issues/34006

jrmoreno1 commented 5 years ago

I think this is better addressed by #91, however it gets resolved. 8mplements and assigning the value/declaration should be independent.

VBAndCs commented 5 years ago

@jrmoreno1 Thanks. #91 gave me a new idea: using attributes:

Class Foo
    Implements IFoo

    <[Implements]("IFoo", "Value")>
    Public ReadOnly Property Value As String

End Class

or I suggest this special syntax:

    <Implements IFoo.Value>
    Public ReadOnly Property Value As String
jrmoreno1 commented 5 years ago

@VBAndCs: #91 was about dealing with Partial classes?

Class Foo
   Public ReadOnly Property Value As String
End Class

Partial Class Foo
    Implements IFoo

    <[Implements]("IFoo", "Value")>
    Public ReadOnly Property Value As String
End Class

Not too bad..., I prefer just reusing the keyword, but could live with either.