Skip to content

Commit

Permalink
VB CodeStyle related changes. We still haven't moved VB CodeStyle opt…
Browse files Browse the repository at this point in the history
…ions to the shared layer, and I will not be doing it in this PR. That will be in a follow-up PR.
  • Loading branch information
mavasani committed Mar 10, 2020
1 parent 2848a31 commit 70b4089
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ imports Microsoft.CodeAnalysis.Options

Namespace Microsoft.CodeAnalysis.VisualBasic.CodeStyle
Friend NotInheritable Class VisualBasicCodeStyleOptions
Private Shared ReadOnly s_allOptionsBuilder As ImmutableArray(Of IOption).Builder = ImmutableArray.CreateBuilder(Of IOption)
Private Shared ReadOnly s_allOptionsBuilder As ImmutableArray(Of IOption2).Builder = ImmutableArray.CreateBuilder(Of IOption2)

Shared Sub New()
AllOptions = s_allOptionsBuilder.ToImmutable()
End Sub

Private Shared Function CreateOption(Of T)(group As OptionGroup, name As String, defaultValue As T, ParamArray storageLocations As OptionStorageLocation()) As [Option](Of T)
Private Shared Function CreateOption(Of T)(group As OptionGroup, name As String, defaultValue As T, ParamArray storageLocations As OptionStorageLocation2()) As [Option2](Of T)
Return CodeStyleHelpers.CreateOption(group, NameOf(VisualBasicCodeStyleOptions), name, defaultValue, s_allOptionsBuilder, storageLocations)
End Function

Public Shared ReadOnly Property AllOptions As ImmutableArray(Of IOption)
Public Shared ReadOnly Property AllOptions As ImmutableArray(Of IOption2)

Public Shared ReadOnly PreferredModifierOrderDefault As ImmutableArray(Of SyntaxKind) =
ImmutableArray.Create(
Expand All @@ -30,28 +30,28 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeStyle
SyntaxKind.WithEventsKeyword, SyntaxKind.WideningKeyword, SyntaxKind.NarrowingKeyword, SyntaxKind.CustomKeyword,
SyntaxKind.AsyncKeyword, SyntaxKind.IteratorKeyword)

Public Shared ReadOnly PreferredModifierOrder As [Option](Of CodeStyleOption(Of String)) = CreateOption(
Public Shared ReadOnly PreferredModifierOrder As [Option2](Of CodeStyleOption2(Of String)) = CreateOption(
VisualBasicCodeStyleOptionGroups.Modifier, NameOf(PreferredModifierOrder),
defaultValue:=New CodeStyleOption(Of String)(String.Join(",", PreferredModifierOrderDefault.Select(AddressOf SyntaxFacts.GetText)), NotificationOption.Silent),
defaultValue:=New CodeStyleOption2(Of String)(String.Join(",", PreferredModifierOrderDefault.Select(AddressOf SyntaxFacts.GetText)), NotificationOption.Silent),
EditorConfigStorageLocation.ForStringCodeStyleOption("visual_basic_preferred_modifier_order"),
New RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{NameOf(PreferredModifierOrder)}"))

Public Shared ReadOnly UnusedValueExpressionStatement As [Option](Of CodeStyleOption(Of UnusedValuePreference)) =
Public Shared ReadOnly UnusedValueExpressionStatement As [Option2](Of CodeStyleOption2(Of UnusedValuePreference)) =
CodeStyleHelpers.CreateUnusedExpressionAssignmentOption(
group:=VisualBasicCodeStyleOptionGroups.ExpressionLevelPreferences,
feature:=NameOf(VisualBasicCodeStyleOptions),
name:=NameOf(UnusedValueExpressionStatement),
editorConfigName:="visual_basic_style_unused_value_expression_statement_preference",
defaultValue:=New CodeStyleOption(Of UnusedValuePreference)(UnusedValuePreference.UnusedLocalVariable, NotificationOption.Silent),
defaultValue:=New CodeStyleOption2(Of UnusedValuePreference)(UnusedValuePreference.UnusedLocalVariable, NotificationOption.Silent),
optionsBuilder:=s_allOptionsBuilder)

Public Shared ReadOnly UnusedValueAssignment As [Option](Of CodeStyleOption(Of UnusedValuePreference)) =
Public Shared ReadOnly UnusedValueAssignment As [Option2](Of CodeStyleOption2(Of UnusedValuePreference)) =
CodeStyleHelpers.CreateUnusedExpressionAssignmentOption(
group:=VisualBasicCodeStyleOptionGroups.ExpressionLevelPreferences,
feature:=NameOf(VisualBasicCodeStyleOptions),
name:=NameOf(UnusedValueAssignment),
editorConfigName:="visual_basic_style_unused_value_assignment_preference",
defaultValue:=New CodeStyleOption(Of UnusedValuePreference)(UnusedValuePreference.UnusedLocalVariable, NotificationOption.Suggestion),
defaultValue:=New CodeStyleOption2(Of UnusedValuePreference)(UnusedValuePreference.UnusedLocalVariable, NotificationOption.Suggestion),
optionsBuilder:=s_allOptionsBuilder)
End Class

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeStyle

Public ReadOnly Property Options As ImmutableArray(Of IOption) Implements IOptionProvider.Options
Get
Return VisualBasicCodeStyleOptions.AllOptions
Return VisualBasicCodeStyleOptions.AllOptions.As(Of IOption)
End Get
End Property
End Class
Expand Down

0 comments on commit 70b4089

Please sign in to comment.