Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
9af286b
Fix version
CyrusNajmabadi Jun 17, 2025
f1e7a67
In progress
CyrusNajmabadi Jun 18, 2025
0b25d8d
Fix
CyrusNajmabadi Jun 18, 2025
48053b1
fix
CyrusNajmabadi Jun 18, 2025
0daf95e
Remove
CyrusNajmabadi Jun 18, 2025
1beb198
fix
CyrusNajmabadi Jun 18, 2025
cfd26fe
fix
CyrusNajmabadi Jun 18, 2025
abfbfc6
fix
CyrusNajmabadi Jun 18, 2025
6c62edb
Merge remote-tracking branch 'upstream/main' into analyzerWork
CyrusNajmabadi Jun 18, 2025
3e08ace
Fixup
CyrusNajmabadi Jun 18, 2025
c632cbf
Comment out
CyrusNajmabadi Jun 18, 2025
cb32937
Fix
CyrusNajmabadi Jun 18, 2025
d316719
Fix
CyrusNajmabadi Jun 18, 2025
5b2ba52
Get more compiling
CyrusNajmabadi Jun 18, 2025
c4c76e6
Update versions
CyrusNajmabadi Jun 18, 2025
14d1d34
Update versions
CyrusNajmabadi Jun 18, 2025
0f687ed
update version
CyrusNajmabadi Jun 18, 2025
bd8e197
Update version
CyrusNajmabadi Jun 18, 2025
8f95b97
Update version
CyrusNajmabadi Jun 18, 2025
ca6c7ea
Fixup
CyrusNajmabadi Jun 18, 2025
0f0e1fd
Building
CyrusNajmabadi Jun 18, 2025
c7a66e6
More building
CyrusNajmabadi Jun 18, 2025
d6c47d6
Build
CyrusNajmabadi Jun 19, 2025
edc3056
Fixes
CyrusNajmabadi Jun 19, 2025
d42b32c
Fixes
CyrusNajmabadi Jun 19, 2025
bc57bf3
Fixes
CyrusNajmabadi Jun 19, 2025
4479abd
Fixes
CyrusNajmabadi Jun 19, 2025
f3f0442
Fixes
CyrusNajmabadi Jun 19, 2025
ccbeb97
building
CyrusNajmabadi Jun 19, 2025
fdb858d
Fixes
CyrusNajmabadi Jun 19, 2025
54e0735
Fixes
CyrusNajmabadi Jun 19, 2025
6bf5753
Fixes
CyrusNajmabadi Jun 19, 2025
1fad1eb
Fixes
CyrusNajmabadi Jun 19, 2025
7b4e97b
Fixes
CyrusNajmabadi Jun 19, 2025
43975af
Fixes
CyrusNajmabadi Jun 19, 2025
08ec8e6
Fixes
CyrusNajmabadi Jun 19, 2025
8b2a9a4
Fixes
CyrusNajmabadi Jun 19, 2025
aa89456
Fixes
CyrusNajmabadi Jun 19, 2025
0850355
Fixes
CyrusNajmabadi Jun 19, 2025
639fcc2
Fixes
CyrusNajmabadi Jun 19, 2025
4a43994
Fixes
CyrusNajmabadi Jun 19, 2025
8649c1e
Fixes
CyrusNajmabadi Jun 19, 2025
972293e
Fixes
CyrusNajmabadi Jun 19, 2025
5f324c3
Fixes
CyrusNajmabadi Jun 19, 2025
f6c93b1
Fixes
CyrusNajmabadi Jun 19, 2025
7eeac7f
Fixes
CyrusNajmabadi Jun 19, 2025
3aa33fe
Fixes
CyrusNajmabadi Jun 19, 2025
7e45300
Fixes
CyrusNajmabadi Jun 19, 2025
af4cd51
Fixes
CyrusNajmabadi Jun 19, 2025
ac51485
Fixes
CyrusNajmabadi Jun 20, 2025
ec933f0
Fixes
CyrusNajmabadi Jun 20, 2025
c982a28
Fixes
CyrusNajmabadi Jun 20, 2025
bab0aeb
Fixes
CyrusNajmabadi Jun 20, 2025
73bfe32
Fixes
CyrusNajmabadi Jun 20, 2025
dee647c
Fixes
CyrusNajmabadi Jun 20, 2025
79ea2b9
Fixes
CyrusNajmabadi Jun 20, 2025
49a66a6
Fixes
CyrusNajmabadi Jun 20, 2025
95ab927
Fixes
CyrusNajmabadi Jun 20, 2025
34271f5
Fixes
CyrusNajmabadi Jun 20, 2025
3bc4d11
Fixes
CyrusNajmabadi Jun 20, 2025
cf40bb8
Add version check
CyrusNajmabadi Jun 20, 2025
20e3731
roll version back
CyrusNajmabadi Jun 20, 2025
7736f9e
run on 4.12
CyrusNajmabadi Jun 20, 2025
f2424d7
run on 4.12
CyrusNajmabadi Jun 20, 2025
b4c710a
run on 4.12
CyrusNajmabadi Jun 20, 2025
c130701
run on 4.12
CyrusNajmabadi Jun 20, 2025
b593ca6
run on 4.12
CyrusNajmabadi Jun 20, 2025
e1b122f
run on 4.12
CyrusNajmabadi Jun 20, 2025
af06be7
run on 4.12
CyrusNajmabadi Jun 20, 2025
4263a20
run on 4.12
CyrusNajmabadi Jun 20, 2025
be1d8cb
run on 4.12
CyrusNajmabadi Jun 20, 2025
318d135
run on 4.12
CyrusNajmabadi Jun 20, 2025
80ae2c8
in progress
CyrusNajmabadi Jun 20, 2025
e89f3dc
Merge branch 'removeAnalyzerReferences' into analyzerWork
CyrusNajmabadi Jun 20, 2025
ee0f2e6
run on 4.12
CyrusNajmabadi Jun 20, 2025
6f7c1dd
Merge branch 'vbShared' into analyzerWork
CyrusNajmabadi Jun 20, 2025
7023502
Fix warning
CyrusNajmabadi Jun 20, 2025
23e2fe0
fix
CyrusNajmabadi Jun 20, 2025
23d0dc2
Get building
CyrusNajmabadi Jun 20, 2025
75802b8
Merge branch 'vbShared' into analyzerWork
CyrusNajmabadi Jun 20, 2025
7bdb068
run on 4.12
CyrusNajmabadi Jun 20, 2025
c626a61
building
CyrusNajmabadi Jun 20, 2025
da0a4e1
break public/internal
CyrusNajmabadi Jun 20, 2025
9fafb2f
Just be public
CyrusNajmabadi Jun 20, 2025
515d60b
Cleanup
CyrusNajmabadi Jun 20, 2025
77a0268
Cleanup
CyrusNajmabadi Jun 20, 2025
a660e8c
Cleanup
CyrusNajmabadi Jun 20, 2025
8ecc6f5
Cleanup
CyrusNajmabadi Jun 20, 2025
17d4a07
Cleanup
CyrusNajmabadi Jun 20, 2025
dc01cc1
Cleanup
CyrusNajmabadi Jun 20, 2025
c8a20ad
Fixes
CyrusNajmabadi Jun 20, 2025
5f94abc
in rpgoress
CyrusNajmabadi Jun 20, 2025
67a1018
Merge remote-tracking branch 'upstream/main' into analyzerWork
CyrusNajmabadi Jun 20, 2025
ccb3bdb
in progress
CyrusNajmabadi Jun 20, 2025
d0738f3
Merge branch 'csharpFOrmattingOptionLayering' into analyzerWork
CyrusNajmabadi Jun 20, 2025
52999a2
move
CyrusNajmabadi Jun 20, 2025
0178009
Fix merges
CyrusNajmabadi Jun 20, 2025
65b132a
Fix building
CyrusNajmabadi Jun 20, 2025
e4d38c8
Merge branch 'semanticModelReuse' into analyzerWork
CyrusNajmabadi Jun 20, 2025
0fb4cb8
Merge remote-tracking branch 'upstream/main' into analyzerWork
CyrusNajmabadi Jun 20, 2025
55d0888
Fix merge conflict
CyrusNajmabadi Jun 20, 2025
a637896
Fixes
CyrusNajmabadi Jun 20, 2025
589ddf7
Merge branch 'csharpFOrmattingOptionLayering' into analyzerWork
CyrusNajmabadi Jun 20, 2025
400c917
Merge branch 'main' into analyzerWork
CyrusNajmabadi Jun 21, 2025
43f65f1
Disable warnings
CyrusNajmabadi Jun 21, 2025
79e51eb
delete unused code.
CyrusNajmabadi Jun 21, 2025
43b0fa1
add define
CyrusNajmabadi Jun 21, 2025
f8e0686
Delete extensions
CyrusNajmabadi Jun 21, 2025
b5692f8
Delete files
CyrusNajmabadi Jun 21, 2025
32a5793
Disable extensions
CyrusNajmabadi Jun 21, 2025
7483f30
building metrics
CyrusNajmabadi Jun 21, 2025
405b044
building text.analyzers
CyrusNajmabadi Jun 21, 2025
5d15453
building banned apis
CyrusNajmabadi Jun 21, 2025
d2c8d22
building perf analyzers
CyrusNajmabadi Jun 21, 2025
a1568fe
building perf analyzers
CyrusNajmabadi Jun 21, 2025
f2e5b36
Fixes
CyrusNajmabadi Jun 21, 2025
ebb062e
building public api
CyrusNajmabadi Jun 21, 2025
e72aca4
building resx
CyrusNajmabadi Jun 21, 2025
d615d79
building diagnostics
CyrusNajmabadi Jun 21, 2025
c40cb81
building diagnostics
CyrusNajmabadi Jun 21, 2025
474fd9c
get more building
CyrusNajmabadi Jun 21, 2025
d94ea42
roslyn debug
CyrusNajmabadi Jun 21, 2025
a182e50
roslyn debug
CyrusNajmabadi Jun 21, 2025
43eb81c
test utilities
CyrusNajmabadi Jun 21, 2025
7867663
test utilities
CyrusNajmabadi Jun 21, 2025
0366273
test utilities
CyrusNajmabadi Jun 21, 2025
cc1ab83
test utilities
CyrusNajmabadi Jun 21, 2025
bb13144
dispose
CyrusNajmabadi Jun 21, 2025
7c002cb
collection
CyrusNajmabadi Jun 21, 2025
4c1e728
Building
CyrusNajmabadi Jun 21, 2025
9088af2
Delete unused code
CyrusNajmabadi Jun 21, 2025
ac66ad2
Delete unused code
CyrusNajmabadi Jun 21, 2025
88a6ad6
Delete unused code
CyrusNajmabadi Jun 21, 2025
6faf157
Delete unused code
CyrusNajmabadi Jun 21, 2025
c9fa791
Delete unused code
CyrusNajmabadi Jun 21, 2025
b895a41
Delete unused code
CyrusNajmabadi Jun 21, 2025
e084354
Delete unused code
CyrusNajmabadi Jun 21, 2025
9f88734
Delete unused code
CyrusNajmabadi Jun 21, 2025
b127c75
Delete unused code
CyrusNajmabadi Jun 21, 2025
3463739
Delete unused code
CyrusNajmabadi Jun 21, 2025
b97ebd8
Delete unused code
CyrusNajmabadi Jun 21, 2025
befa388
Delete unused code
CyrusNajmabadi Jun 21, 2025
e04f437
Delete unused code
CyrusNajmabadi Jun 21, 2025
51eadaf
Delete unused code
CyrusNajmabadi Jun 21, 2025
780a170
Delete unused code
CyrusNajmabadi Jun 21, 2025
3fec28c
Delete unused code
CyrusNajmabadi Jun 21, 2025
11834f3
Delete unused code
CyrusNajmabadi Jun 21, 2025
4fdedae
Delete unused code
CyrusNajmabadi Jun 21, 2025
897d88a
Delete unused code
CyrusNajmabadi Jun 21, 2025
26f6c3f
Delete unused code
CyrusNajmabadi Jun 21, 2025
4fe56aa
Delete unused code
CyrusNajmabadi Jun 21, 2025
7b1712a
Delete unused code
CyrusNajmabadi Jun 21, 2025
7d7a41c
Restore
CyrusNajmabadi Jun 21, 2025
57aa92d
Restore
CyrusNajmabadi Jun 21, 2025
5ee7bed
Fix
CyrusNajmabadi Jun 21, 2025
ab88418
Fixes
CyrusNajmabadi Jun 21, 2025
437356b
Cleanup iop code
CyrusNajmabadi Jun 21, 2025
b47b2f4
remove lightup
CyrusNajmabadi Jun 21, 2025
4cf9c07
remove lightup
CyrusNajmabadi Jun 21, 2025
3fdb0dc
remove
CyrusNajmabadi Jun 21, 2025
d98d813
remove unused extensions
CyrusNajmabadi Jun 21, 2025
54c70ac
remove
CyrusNajmabadi Jun 21, 2025
35529fa
Delete files
CyrusNajmabadi Jun 21, 2025
32678bc
revert
CyrusNajmabadi Jun 21, 2025
1970f07
Remove
CyrusNajmabadi Jun 21, 2025
130545b
Update src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBa…
CyrusNajmabadi Jun 21, 2025
896230d
Update src/CodeStyle/Core/Analyzers/Microsoft.CodeAnalysis.CodeStyle.…
CyrusNajmabadi Jun 21, 2025
6997c9b
Merge remote-tracking branch 'upstream/main' into analyzerWork
CyrusNajmabadi Jun 23, 2025
4de5c99
Merge branch 'main' into analyzerWork
CyrusNajmabadi Jun 23, 2025
cddde18
Apply suggestions from code review
CyrusNajmabadi Jun 23, 2025
b4e6491
Update eng/Versions.props
CyrusNajmabadi Jun 23, 2025
afe4291
Sort
CyrusNajmabadi Jun 23, 2025
c3bd2f9
Merge branch 'analyzerWork' of https://github.com/CyrusNajmabadi/rosl…
CyrusNajmabadi Jun 23, 2025
13d651e
Merge remote-tracking branch 'upstream/main' into analyzerWork
CyrusNajmabadi Jun 23, 2025
e857048
move down
CyrusNajmabadi Jun 23, 2025
e326309
Fix
CyrusNajmabadi Jun 23, 2025
0a46715
Update src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGen…
CyrusNajmabadi Jun 23, 2025
d3f910e
Update src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGen…
CyrusNajmabadi Jun 23, 2025
22e9ee8
Fix paths
JoeRobich Jun 23, 2025
517c2ae
Update src/RoslynAnalyzers/Utilities/Compiler/Extensions/INamedTypeSy…
CyrusNajmabadi Jun 24, 2025
d265a77
Update src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGen…
CyrusNajmabadi Jun 24, 2025
c0a01b4
Merge remote-tracking branch 'origin/main' into analyzerWork
CyrusNajmabadi Jun 24, 2025
a137049
Revert this part
CyrusNajmabadi Jun 24, 2025
6274d80
Revert this part
CyrusNajmabadi Jun 24, 2025
e12421c
Update src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Extension…
CyrusNajmabadi Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Workspaces\Core\Portable\Formatting\VisualBasic\VisualBasicSyntaxFormattingOptions.cs" Link="Formatting\VisualBasic\VisualBasicSyntaxFormattingOptions.cs" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

referencing this now in the shrred lib. not as this weird one-off in a real project.

</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="CodeStyleResources.resx" GenerateSource="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<RootNamespace>Microsoft.CodeAnalysis.CSharp</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetRoslynSourceBuild);netstandard2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);CSHARP_WORKSPACE</DefineConstants>
<ApplyNgenOptimization Condition="'$(TargetFramework)' == 'netstandard2.0'">full</ApplyNgenOptimization>

<!-- NuGet -->
Expand Down Expand Up @@ -47,6 +48,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Razor.Features" />
<InternalsVisibleTo Include="IdeCoreBenchmarks" />
<InternalsVisibleTo Include="Roslyn.VisualStudio.Next.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Workspaces.Test.Utilities"/>
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.New.IntegrationTests" />
<InternalsVisibleTo Include="Microsoft.VisualStudio.Completion.Tests" Key="$(IntelliCodeCSharpKey)" WorkItem="https://github.com/dotnet/roslyn/issues/35081" />
<InternalsVisibleTo Include="AITools.CodeAnalysis" Key="$(AIToolsKey)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ internal static class CSharpSyntaxTokens
public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken);
public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken);
public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword);
#if !ROSLYN_4_12_OR_LOWER
public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword);
#endif
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be used in RoslynAnalyzers, which will only be able to reference up to Ros 4.12 (we're currently at ros 4.14).

public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword);
public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword);
public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments that don't result when this is pulled into libs that don't reference all of the shared side of roslyn workspace.


using System.Xml.Linq;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public static SyntaxToken GetNameToken(this MemberDeclarationSyntax member)
case SyntaxKind.EnumDeclaration:
return ((EnumDeclarationSyntax)member).Identifier;
case SyntaxKind.ClassDeclaration:
#if !ROSLYN_4_12_OR_LOWER
case SyntaxKind.ExtensionBlockDeclaration:
#endif
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration:
Expand Down Expand Up @@ -72,7 +74,9 @@ public static int GetArity(this MemberDeclarationSyntax member)
switch (member.Kind())
{
case SyntaxKind.ClassDeclaration:
#if !ROSLYN_4_12_OR_LOWER
case SyntaxKind.ExtensionBlockDeclaration:
#endif
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration:
Expand All @@ -97,7 +101,9 @@ public static int GetArity(this MemberDeclarationSyntax member)
switch (member.Kind())
{
case SyntaxKind.ClassDeclaration:
#if !ROSLYN_4_12_OR_LOWER
case SyntaxKind.ExtensionBlockDeclaration:
#endif
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.RecordDeclaration:
case SyntaxKind.RecordStructDeclaration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Formatting;

#if CODE_STYLE
using CSharpWorkspaceResources = Microsoft.CodeAnalysis.CSharp.CSharpCodeStyleResources;
#endif

namespace Microsoft.CodeAnalysis.CSharp.Formatting;

internal static partial class CSharpFormattingOptions2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,11 @@ is SyntaxKind.IdentifierToken
or SyntaxKind.DefaultKeyword
or SyntaxKind.BaseKeyword
or SyntaxKind.ThisKeyword
or SyntaxKind.ExtensionKeyword ||
previousToken.IsGenericGreaterThanToken() ||
currentToken.IsParenInArgumentList())
#if !ROSLYN_4_12_OR_LOWER
or SyntaxKind.ExtensionKeyword
#endif
|| previousToken.IsGenericGreaterThanToken()
|| currentToken.IsParenInArgumentList())
{
return CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpacesIfOnSingleLine);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ IdentifierNameSyntax nameSyntax when IsInPreprocessingSymbolContext(nameSyntax)
};

private static IPreprocessingSymbol? CreatePreprocessingSymbol(SemanticModel model, SyntaxToken identifier)
#if !ROSLYN_4_12_OR_LOWER
=> model.Compilation.CreatePreprocessingSymbol(identifier.ValueText);
#else
=> null;
#endif

private static bool IsInPreprocessingSymbolContext(SyntaxNode node)
=> node.Ancestors().Any(n => n.Kind() is
Expand All @@ -417,7 +421,7 @@ SyntaxKind.DefineDirectiveTrivia or
public bool TryGetPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor)
=> typeSymbol.TryGetPrimaryConstructor(out primaryConstructor);

#if !CODE_STYLE
#if CSHARP_WORKSPACE
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RoslynAnalyzers is also "!CODE_STYLE". so that breaks badly when sharing these files. i didn't feel comfortable defining that constnat for RoslynAnalyzers. So instead, i just flipped these to be either WORKSPACE or !WORKSPACE so that the right semantics are there for the workspace layer vs anyone else.


public async Task<ISymbol?> GetInterceptorSymbolAsync(Document document, int position, CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ public string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, strin

return builder.ToString();
}
#if !ROSLYN_4_12_OR_LOWER
else if (memberDeclaration is ExtensionBlockDeclarationSyntax extensionDeclaration)
{
using var _ = PooledStringBuilder.GetInstance(out var builder);
Expand All @@ -847,6 +848,7 @@ public string GetDisplayName(SyntaxNode? node, DisplayNameOptions options, strin
AppendParameterList(builder, extensionDeclaration.ParameterList);
return builder.ToString();
}
#endif
else
{
Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember);
Expand All @@ -872,6 +874,7 @@ static void AppendTypeParameterList(StringBuilder builder, TypeParameterListSynt
}
}

#if !ROSLYN_4_12_OR_LOWER
void AppendParameterList(StringBuilder builder, ParameterListSyntax? parameterList)
{
if (parameterList != null)
Expand All @@ -881,6 +884,7 @@ void AppendParameterList(StringBuilder builder, ParameterListSyntax? parameterLi
builder.Append(')');
}
}
#endif
}

public SyntaxList<SyntaxNode> GetMembersOfTypeDeclaration(SyntaxNode typeDeclaration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Formatting\FormattingOptions2.IndentStyle.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\LineFormattingOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\SyntaxFormattingOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\VisualBasic\VisualBasicSyntaxFormattingOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\RemoveUnnecessaryImports\RemoveUnnecessaryImportsHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Indentation\AbstractIndentation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Indentation\AbstractIndentation.Indenter.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.CodeAnalysis.Diagnostics;

internal static class DiagnosticCategory
internal static partial class DiagnosticCategory
{
public const string Style = nameof(Style);
public const string CodeQuality = nameof(CodeQuality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ namespace Microsoft.CodeAnalysis.Diagnostics;

internal static partial class DiagnosticSeverityExtensions
{
/// <summary>
/// Returns the equivalent <see cref="ReportDiagnostic"/> for a <see cref="DiagnosticSeverity"/> value.
/// </summary>
/// <param name="diagnosticSeverity">The <see cref="DiagnosticSeverity"/> value.</param>
/// <returns>
/// The equivalent <see cref="ReportDiagnostic"/> for the <see cref="DiagnosticSeverity"/> value.
/// </returns>
/// <exception cref="InvalidOperationException">
/// If <paramref name="diagnosticSeverity"/> is not one of the expected values.
/// </exception>
public static ReportDiagnostic ToReportDiagnostic(this DiagnosticSeverity diagnosticSeverity)
=> diagnosticSeverity switch
{
DiagnosticSeverity.Hidden => ReportDiagnostic.Hidden,
DiagnosticSeverity.Info => ReportDiagnostic.Info,
DiagnosticSeverity.Warning => ReportDiagnostic.Warn,
DiagnosticSeverity.Error => ReportDiagnostic.Error,
_ => throw ExceptionUtilities.UnexpectedValue(diagnosticSeverity),
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to better location.


public static string ToEditorConfigString(this DiagnosticSeverity diagnosticSeverity)
{
return diagnosticSeverity switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,6 @@ namespace Microsoft.CodeAnalysis.Diagnostics;

internal static partial class ReportDiagnosticExtensions
{
/// <summary>
/// Returns the equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value.
/// </summary>
/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
/// <returns>
/// The equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value; otherwise,
/// <see langword="null"/> if <see cref="DiagnosticSeverity"/> does not contain a direct equivalent for
/// <paramref name="reportDiagnostic"/>.
/// </returns>
/// <exception cref="InvalidOperationException">
/// If <paramref name="reportDiagnostic"/> is not one of the expected values.
/// </exception>
public static DiagnosticSeverity? ToDiagnosticSeverity(this ReportDiagnostic reportDiagnostic)
{
switch (reportDiagnostic)
{
case ReportDiagnostic.Error:
return DiagnosticSeverity.Error;

case ReportDiagnostic.Warn:
return DiagnosticSeverity.Warning;

case ReportDiagnostic.Info:
return DiagnosticSeverity.Info;

case ReportDiagnostic.Hidden:
return DiagnosticSeverity.Hidden;

case ReportDiagnostic.Suppress:
case ReportDiagnostic.Default:
return null;

default:
throw ExceptionUtilities.UnexpectedValue(reportDiagnostic);
}
}

/// <summary>
/// Applies a default severity to a <see cref="ReportDiagnostic"/> value.
/// </summary>
/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
/// <param name="defaultSeverity">The default severity.</param>
/// <returns>
/// <para>If <paramref name="reportDiagnostic"/> is <see cref="ReportDiagnostic.Default"/>, returns
/// <paramref name="defaultSeverity"/>.</para>
/// <para>-or-</para>
/// <para>Otherwise, returns <paramref name="reportDiagnostic"/> if it has a non-default value.</para>
/// </returns>
public static ReportDiagnostic WithDefaultSeverity(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity)
{
if (reportDiagnostic != ReportDiagnostic.Default)
{
return reportDiagnostic;
}

return defaultSeverity.ToReportDiagnostic();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to better location.


public static string ToEditorConfigString(this ReportDiagnostic reportDiagnostic)
{
return reportDiagnostic switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;

#if !CODE_STYLE
#if WORKSPACE
using Humanizer;
#endif

Expand Down Expand Up @@ -204,7 +204,7 @@ private static bool TryGeneratePluralizedNameFromTypeArgument(

public static string Pluralize(string word)
{
#if CODE_STYLE
#if !WORKSPACE
return word;
#else
return word.Pluralize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
using Microsoft.CodeAnalysis.Indentation;
using Microsoft.CodeAnalysis.CodeStyle;

#if CODE_STYLE
using WorkspacesResources = Microsoft.CodeAnalysis.CodeStyleResources;
#if !WORKSPACE
using PublicIndentStyle = Microsoft.CodeAnalysis.Formatting.FormattingOptions2.IndentStyle;
#else
using PublicIndentStyle = Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis.Options;
using System.Collections.Immutable;

#if !CODE_STYLE
#if WORKSPACE
using Microsoft.CodeAnalysis.Host;
#endif

Expand All @@ -33,7 +33,7 @@ internal static class NamingStyleOptions
}

internal interface NamingStylePreferencesProvider
#if !CODE_STYLE
#if WORKSPACE
: OptionsProvider<NamingStylePreferences>
#endif
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ namespace Microsoft.CodeAnalysis.Options;
/// set of interface members.
/// </summary>
internal interface IOption2 : IEquatable<IOption2?>
#if !CODE_STYLE
#if WORKSPACE
, IOption
#endif
{
OptionDefinition Definition { get; }
IPublicOption? PublicOption { get; }

#if CODE_STYLE
#if !WORKSPACE
bool IsPerLanguage { get; }
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void VerifyNamingConvention()
public T DefaultValue => Definition.DefaultValue;
OptionDefinition IOption2.Definition => Definition;

#if CODE_STYLE
#if !WORKSPACE
bool IOption2.IsPerLanguage => false;
#else
string IOption.Feature => "config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static bool IsSupportedOptionType(Type type)
type == typeof(long?) ||
type.IsEnum ||
Nullable.GetUnderlyingType(type)?.IsEnum == true ||
#if !CODE_STYLE
#if WORKSPACE
typeof(ICodeStyleOption).IsAssignableFrom(type) ||
#endif
typeof(ICodeStyleOption2).IsAssignableFrom(type) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void VerifyNamingConvention()
OptionDefinition IOption2.Definition => Definition;
public T DefaultValue => Definition.DefaultValue;

#if CODE_STYLE
#if !WORKSPACE
bool IOption2.IsPerLanguage => true;
#else
string IOption.Feature => "config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Options;

internal static class PublicOptionFactory
{
#if CODE_STYLE
#if !WORKSPACE
#pragma warning disable IDE0060 // Remove unused parameter

// Stubs to avoid #ifdefs at call sites.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#pragma warning disable CS0419 // Ambiguous reference in cref attribute

using System;
using System.Diagnostics;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal partial interface ISemanticFacts

bool TryGetPrimaryConstructor(INamedTypeSymbol typeSymbol, [NotNullWhen(true)] out IMethodSymbol? primaryConstructor);

#if !CODE_STYLE
#if WORKSPACE

/// <summary>
/// Given a location in a document, returns the symbol that intercepts the original symbol called at that location.
Expand Down
Loading
Loading