Roslyn: VB preferred modifiers order is inconsistent with C#

Created on 1 Sep 2020  路  7Comments  路  Source: dotnet/roslyn

Partial is set to be the first modifier in visual_basic_preferred_modifier_order

Opening per https://github.com/dotnet/roslyn/pull/47148#discussion_r481325911

Area-IDE Resolution-By Design

Most helpful comment

I think we should close this out. The order is inconsistent, but that's an intentional design choice based on the history of the languages. C# even required that partial not be reorderable, while vb allowed it. Vb also auto formatted this since the beginning. This naturally led to the different common styles for each language's ecosystems that we are respecting. To me, there is no issue here.

All 7 comments

It is not a goal for the preferred modifiers in VB to be consistent with C#. It is only a goal that the modifiers in VB adhere to the defaults that a VB developer would expect in the complete absence of C#.

@sharwell In that case, partial also doesn't feel good to become first.
I think the main concern here is whether to accept this breaking change or not, right?

I'm not a VB developer so I'm not sure what the expected default order is.

Whether or not we like the default value, the order we use for dotnet/roslyn should be explicitly set in .editorconfig.

This is what Roslyn and WinForms use and I think most VB developers would be happy with.

visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion

I does not match C# so is in a separate section.

If Partial is preferred to be at first in VB, then I think we shouldn't override that in editorconfig

cc: @333fred @mavasani

partial has always been sorted first in VB every since that keyword was added.

I think we should close this out. The order is inconsistent, but that's an intentional design choice based on the history of the languages. C# even required that partial not be reorderable, while vb allowed it. Vb also auto formatted this since the beginning. This naturally led to the different common styles for each language's ecosystems that we are respecting. To me, there is no issue here.

Was this page helpful?
0 / 5 - 0 ratings