Skip to content

Commit

Permalink
Changes to CodeStyle layer to delete linked files and trim public APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
mavasani committed Mar 10, 2020
1 parent a9da22c commit b9cf84d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 178 deletions.
13 changes: 6 additions & 7 deletions src/CodeStyle/BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
P:Microsoft.CodeAnalysis.Project.LanguageServices; Use 'GetExtendedLanguageServices' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
M:Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(System.String); Use 'GetExtendedLanguageServices' or directly get the language service by invoking 'GetLanguageService' or 'GetRequiredLanguageService' in CodeStyle layer (preprocessor variable 'CODE_STYLE')
P:Microsoft.CodeAnalysis.Project.LanguageServices; Use 'GetExtendedLanguageServices' instead
M:Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(System.String); Use 'GetExtendedLanguageServices' or directly get the language service by invoking 'GetLanguageService' or 'GetRequiredLanguageService'
T:Microsoft.CodeAnalysis.Options.OptionSet; 'OptionSet' is not available in CodeStyle layer. Add a using/Imports statement defining 'OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions' when preprocessor variable 'CODE_STYLE' is defined
T:Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption`1; Use 'Microsoft.CodeAnalysis.Internal.Options.CodeStyleOption' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
T:Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions; Use 'Microsoft.CodeAnalysis.Internal.Options.CodeStyleOptions' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
T:Microsoft.CodeAnalysis.Options.IOption; Use 'Microsoft.CodeAnalysis.Internal.Options.IOption' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
T:Microsoft.CodeAnalysis.Options.OptionKey; Use 'Microsoft.CodeAnalysis.Internal.Options.OptionKey' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
T:Microsoft.CodeAnalysis.CodeStyle.NotificationOption; Use 'Microsoft.CodeAnalysis.Internal.Options.NotificationOption' instead in CodeStyle layer (preprocessor variable 'CODE_STYLE')
T:Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption`1; Use 'Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption2' instead
T:Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions; Use 'Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions2' instead
T:Microsoft.CodeAnalysis.Options.OptionKey; Use 'Microsoft.CodeAnalysis.Options.OptionKey2' instead
T:Microsoft.CodeAnalysis.CodeStyle.NotificationOption; Use 'Microsoft.CodeAnalysis.CodeStyle.NotificationOption2' instead
56 changes: 0 additions & 56 deletions src/CodeStyle/CSharp/Analyzers/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -1,56 +0,0 @@
Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions
Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Ignore = 1 -> Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions
Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Remove = 2 -> Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions
Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Single = 0 -> Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions
Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions
Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions
Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.LeftMost = 0 -> Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions
Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.NoIndent = 2 -> Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions
Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.OneLess = 1 -> Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBlock.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBraces.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchCaseSection.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchCaseSectionWhenBlock.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchSection.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.LabelPositioning.get -> Microsoft.CodeAnalysis.Internal.Options.Option<Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForCatch.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForClausesInQuery.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForElse.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForFinally.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInAnonymousTypes.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInObjectInit.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAccessors.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousTypes.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInControlBlocks.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInLambdaExpressionBody.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInMethods.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectCollectionArrayInitializers.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInProperties.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInTypes.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterCast.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterColonInBaseTypeDeclaration.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterComma.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterControlFlowStatementKeyword.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterDot.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterMethodCallName.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterSemicolonsInForStatement.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeColonInBaseTypeDeclaration.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeComma.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeDot.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeOpenSquareBracket.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeSemicolonsInForStatement.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodCallParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodDeclarationParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptySquareBrackets.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacesIgnoreAroundVariableDeclaration.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinCastParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinExpressionParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodCallParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodDeclarationParenthesis.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinOtherParentheses.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinSquareBrackets.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAfterMethodDeclarationName.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAroundBinaryOperator.get -> Microsoft.CodeAnalysis.Internal.Options.Option<Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
static Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingPreserveSingleLine.get -> Microsoft.CodeAnalysis.Internal.Options.Option<bool>
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Workspaces\Core\Portable\Editing\DeclarationModifiers.cs" Link="Editing\DeclarationModifiers.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\CodeStyle\CodeStyleOption.cs" Link="Options\CodeStyleOption.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\CodeStyle\CodeStyleOptions.cs" Link="Options\CodeStyleOptions.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\CodeStyle\NotificationOption.cs" Link="Options\NotificationOption.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\EditorConfigStorageLocation.cs" Link="Options\EditorConfigStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\EditorConfigStorageLocationExtensions.cs" Link="Options\EditorConfigStorageLocationExtensions.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\EditorConfigStorageLocation`1.cs" Link="Options\EditorConfigStorageLocation`1.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\IEditorConfigStorageLocation.cs" Link="Options\IEditorConfigStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\IEditorConfigStorageLocation2.cs" Link="Options\IEditorConfigStorageLocation2.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\EditorConfig\NamingStylePreferenceEditorConfigStorageLocation.cs" Link="Options\NamingStylePreferenceEditorConfigStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\IOption.cs" Link="Options\IOption.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\IOptionWithGroup.cs" Link="Options\IOptionWithGroup.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\LocalUserProfileStorageLocation.cs" Link="Options\LocalUserProfileStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\OptionGroup.cs" Link="Options\OptionGroup.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\OptionKey.cs" Link="Options\OptionKey.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\OptionStorageLocation.cs" Link="Options\OptionStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\Option`1.cs" Link="Options\Option`1.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\PerLanguageOption.cs" Link="Options\PerLanguageOption.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Options\RoamingProfileStorageLocation.cs" Link="Options\RoamingProfileStorageLocation.cs" />
<Compile Include="..\..\..\Workspaces\Core\Portable\Simplification\NamingStyleOptions.cs" Link="Options\NamingStyleOptions.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="CodeStyleResources.resx" GenerateSource="true" />
Expand Down
10 changes: 5 additions & 5 deletions src/CodeStyle/Core/Analyzers/Options/AnalyzerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#nullable enable

using System.Threading;
using Microsoft.CodeAnalysis.Internal.Options;
using Microsoft.CodeAnalysis.Options;

namespace Microsoft.CodeAnalysis.Diagnostics
{
internal static partial class AnalyzerHelper
{
public static T GetOption<T>(this AnalyzerOptions analyzerOptions, IOption option, string? language, SyntaxTree syntaxTree, CancellationToken cancellationToken)
public static T GetOption<T>(this AnalyzerOptions analyzerOptions, IOption2 option, string? language, SyntaxTree syntaxTree, CancellationToken cancellationToken)
{
if (analyzerOptions.TryGetEditorConfigOption<T>(option, syntaxTree, out var value))
{
Expand All @@ -21,14 +21,14 @@ public static T GetOption<T>(this AnalyzerOptions analyzerOptions, IOption optio
return (T)option.DefaultValue!;
}

public static T GetOption<T>(this AnalyzerOptions analyzerOptions, Option<T> option, SyntaxTree syntaxTree, CancellationToken cancellationToken)
public static T GetOption<T>(this AnalyzerOptions analyzerOptions, Option2<T> option, SyntaxTree syntaxTree, CancellationToken cancellationToken)
{
return GetOption<T>(analyzerOptions, option, language: null, syntaxTree, cancellationToken);
}

public static T GetOption<T>(this AnalyzerOptions analyzerOptions, PerLanguageOption<T> option, string? language, SyntaxTree syntaxTree, CancellationToken cancellationToken)
public static T GetOption<T>(this AnalyzerOptions analyzerOptions, PerLanguageOption2<T> option, string? language, SyntaxTree syntaxTree, CancellationToken cancellationToken)
{
return GetOption<T>(analyzerOptions, (IOption)option, language, syntaxTree, cancellationToken);
return GetOption<T>(analyzerOptions, (IOption2)option, language, syntaxTree, cancellationToken);
}

public static AnalyzerConfigOptions GetAnalyzerOptionSet(this AnalyzerOptions analyzerOptions, SyntaxTree syntaxTree, CancellationToken cancellationToken)
Expand Down
Loading

0 comments on commit b9cf84d

Please sign in to comment.