mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 00:59:26 +08:00 
			
		
		
		
	Remove the 'net50' TFM
Also updates all dependencies to the latest version. Closes #829
This commit is contained in:
		 Patrik Svensson
					Patrik Svensson
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						Patrik Svensson
					
				
			
						parent
						
							b4cf7a76d3
						
					
				
				
					commit
					dc93edef15
				
			
							
								
								
									
										8
									
								
								.github/workflows/ci.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/ci.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -21,10 +21,6 @@ jobs: | |||||||
|  |  | ||||||
|     - name: Setup .NET SDK |     - name: Setup .NET SDK | ||||||
|       uses: actions/setup-dotnet@v2 |       uses: actions/setup-dotnet@v2 | ||||||
|       with: |  | ||||||
|         dotnet-version: |  |  | ||||||
|           5.0.301 |  | ||||||
|           6.0.101 |  | ||||||
|  |  | ||||||
|     - name: Setup Node.js |     - name: Setup Node.js | ||||||
|       uses: actions/setup-node@v3 |       uses: actions/setup-node@v3 | ||||||
| @@ -80,10 +76,6 @@ jobs: | |||||||
|  |  | ||||||
|       - name: Setup .NET SDK |       - name: Setup .NET SDK | ||||||
|         uses: actions/setup-dotnet@v2 |         uses: actions/setup-dotnet@v2 | ||||||
|         with: |  | ||||||
|           dotnet-version: |  |  | ||||||
|             5.0.301 |  | ||||||
|             6.0.101 |  | ||||||
|  |  | ||||||
|       - name: Integration Tests |       - name: Integration Tests | ||||||
|         shell: bash |         shell: bash | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -43,10 +43,6 @@ jobs: | |||||||
|  |  | ||||||
|       - name: Setup .NET SDK |       - name: Setup .NET SDK | ||||||
|         uses: actions/setup-dotnet@v2 |         uses: actions/setup-dotnet@v2 | ||||||
|         with: |  | ||||||
|           dotnet-version: |  |  | ||||||
|             5.0.301 |  | ||||||
|             6.0.101 |  | ||||||
|  |  | ||||||
|       - name: Build |       - name: Build | ||||||
|         shell: bash |         shell: bash | ||||||
| @@ -70,10 +66,6 @@ jobs: | |||||||
|  |  | ||||||
|     - name: Setup .NET SDK |     - name: Setup .NET SDK | ||||||
|       uses: actions/setup-dotnet@v2 |       uses: actions/setup-dotnet@v2 | ||||||
|       with: |  | ||||||
|         dotnet-version: |  |  | ||||||
|           5.0.301 |  | ||||||
|           6.0.101 |  | ||||||
|  |  | ||||||
|     - name: Setup Node.js |     - name: Setup Node.js | ||||||
|       uses: actions/setup-node@v3 |       uses: actions/setup-node@v3 | ||||||
| @@ -115,10 +107,6 @@ jobs: | |||||||
|  |  | ||||||
|       - name: Setup .NET SDK |       - name: Setup .NET SDK | ||||||
|         uses: actions/setup-dotnet@v2 |         uses: actions/setup-dotnet@v2 | ||||||
|         with: |  | ||||||
|           dotnet-version: |  |  | ||||||
|             5.0.301 |  | ||||||
|             6.0.101 |  | ||||||
|  |  | ||||||
|       - name: Publish |       - name: Publish | ||||||
|         shell: bash |         shell: bash | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "sdk": { |   "sdk": { | ||||||
|     "version": "6.0.101", |     "version": "6.0.300", | ||||||
|     "rollForward": "latestFeature" |     "rollForward": "latestFeature" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.8" /> |     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -12,10 +12,10 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" /> |     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> | ||||||
|     <PackageReference Include="Serilog" Version="2.10.0" /> |     <PackageReference Include="Serilog" Version="2.11.0" /> | ||||||
|     <PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" /> |     <PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" /> | ||||||
|     <PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> |     <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> | ||||||
|     <PackageReference Include="Serilog.Sinks.Map" Version="1.0.2" /> |     <PackageReference Include="Serilog.Sinks.Map" Version="1.0.2" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> |     <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> |     <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| { | { | ||||||
|   "projects": [ "src", "tests" ], |   "projects": [ "src", "tests" ], | ||||||
|   "sdk": { |   "sdk": { | ||||||
|     "version": "6.0.101", |     "version": "6.0.300", | ||||||
|     "rollForward": "latestFeature" |     "rollForward": "latestFeature" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,12 +32,12 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|    |    | ||||||
|   <ItemGroup Label="Package References"> |   <ItemGroup Label="Package References"> | ||||||
|     <PackageReference Include="MinVer" PrivateAssets="All" Version="2.5.0" /> |     <PackageReference Include="MinVer" PrivateAssets="All" Version="4.1.0" /> | ||||||
|     <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.1.1" /> |     <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.1.1" /> | ||||||
|     <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.312"> |     <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435"> | ||||||
|       <PrivateAssets>All</PrivateAssets> |       <PrivateAssets>All</PrivateAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|     <PackageReference Include="Roslynator.Analyzers" Version="3.3.0"> |     <PackageReference Include="Roslynator.Analyzers" Version="4.1.1"> | ||||||
|       <PrivateAssets>All</PrivateAssets> |       <PrivateAssets>All</PrivateAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <OutputType>Exe</OutputType> |     <OutputType>Exe</OutputType> | ||||||
|     <TargetFramework>net5.0</TargetFramework> |     <TargetFramework>net6.0</TargetFramework> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <AdditionalFiles Include="..\stylecop.json" Link="Properties/stylecop.json" /> |     <AdditionalFiles Include="..\stylecop.json" Link="Properties/stylecop.json" /> | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								src/Spectre.Console.Analyzer.v3.ncrunchsolution
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/Spectre.Console.Analyzer.v3.ncrunchsolution
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | <SolutionConfiguration> | ||||||
|  |   <Settings> | ||||||
|  |     <AllowParallelTestExecution>True</AllowParallelTestExecution> | ||||||
|  |     <SolutionConfigured>True</SolutionConfigured> | ||||||
|  |   </Settings> | ||||||
|  | </SolutionConfiguration> | ||||||
| @@ -24,7 +24,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer | |||||||
|                 // if this operation isn't an invocation against one of the System.Console methods |                 // if this operation isn't an invocation against one of the System.Console methods | ||||||
|                 // defined in _methods then we can safely stop analyzing and return; |                 // defined in _methods then we can safely stop analyzing and return; | ||||||
|                 var invocationOperation = (IInvocationOperation)context.Operation; |                 var invocationOperation = (IInvocationOperation)context.Operation; | ||||||
|                 if (!Equals(invocationOperation.TargetMethod.ContainingType, ansiConsoleType)) |                 if (!SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, ansiConsoleType)) | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
| @@ -63,7 +63,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer | |||||||
|             .Ancestors().OfType<MethodDeclarationSyntax>() |             .Ancestors().OfType<MethodDeclarationSyntax>() | ||||||
|             .First() |             .First() | ||||||
|             .ParameterList.Parameters |             .ParameterList.Parameters | ||||||
|             .Any(i => i.Type.NormalizeWhitespace().ToString() == "IAnsiConsole"); |             .Any(i => i.Type?.NormalizeWhitespace()?.ToString() == "IAnsiConsole"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private static bool HasFieldAnsiConsole(SyntaxNode syntaxNode) |     private static bool HasFieldAnsiConsole(SyntaxNode syntaxNode) | ||||||
| @@ -72,7 +72,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer | |||||||
|             .Ancestors() |             .Ancestors() | ||||||
|             .OfType<MethodDeclarationSyntax>() |             .OfType<MethodDeclarationSyntax>() | ||||||
|             .First() |             .First() | ||||||
|             .Modifiers.Any(i => i.Kind() == SyntaxKind.StaticKeyword); |             .Modifiers.Any(i => i.IsKind(SyntaxKind.StaticKeyword)); | ||||||
|  |  | ||||||
|         return syntaxNode |         return syntaxNode | ||||||
|             .Ancestors().OfType<ClassDeclarationSyntax>() |             .Ancestors().OfType<ClassDeclarationSyntax>() | ||||||
| @@ -81,6 +81,6 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer | |||||||
|             .OfType<FieldDeclarationSyntax>() |             .OfType<FieldDeclarationSyntax>() | ||||||
|             .Any(i => |             .Any(i => | ||||||
|                 i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" && |                 i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" && | ||||||
|                 (!isStatic ^ i.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword))); |                 (!isStatic ^ i.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.StaticKeyword)))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -33,12 +33,14 @@ public class NoConcurrentLiveRenderablesAnalyzer : SpectreAnalyzer | |||||||
|                     .Select(i => context.Compilation.GetTypeByMetadataName(i)) |                     .Select(i => context.Compilation.GetTypeByMetadataName(i)) | ||||||
|                     .ToImmutableArray(); |                     .ToImmutableArray(); | ||||||
|  |  | ||||||
|                 if (liveTypes.All(i => !Equals(i, methodSymbol.ContainingType))) |                 if (liveTypes.All(i => !SymbolEqualityComparer.Default.Equals(i, methodSymbol.ContainingType))) | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | #pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer | ||||||
|                 var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree); |                 var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree); | ||||||
|  | #pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer | ||||||
|                 var parentInvocations = invocationOperation |                 var parentInvocations = invocationOperation | ||||||
|                     .Syntax.Ancestors() |                     .Syntax.Ancestors() | ||||||
|                     .OfType<InvocationExpressionSyntax>() |                     .OfType<InvocationExpressionSyntax>() | ||||||
|   | |||||||
| @@ -34,12 +34,15 @@ public class NoPromptsDuringLiveRenderablesAnalyzer : SpectreAnalyzer | |||||||
|                 var ansiConsoleType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsole"); |                 var ansiConsoleType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsole"); | ||||||
|                 var ansiConsoleExtensionsType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsoleExtensions"); |                 var ansiConsoleExtensionsType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsoleExtensions"); | ||||||
|  |  | ||||||
|                 if (!Equals(methodSymbol.ContainingType, ansiConsoleType) && !Equals(methodSymbol.ContainingType, ansiConsoleExtensionsType)) |                 if (!SymbolEqualityComparer.Default.Equals(methodSymbol.ContainingType, ansiConsoleType) && | ||||||
|  |                     !SymbolEqualityComparer.Default.Equals(methodSymbol.ContainingType, ansiConsoleExtensionsType)) | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | #pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer | ||||||
|                 var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree); |                 var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree); | ||||||
|  | #pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer | ||||||
|                 var parentInvocations = invocationOperation |                 var parentInvocations = invocationOperation | ||||||
|                     .Syntax.Ancestors() |                     .Syntax.Ancestors() | ||||||
|                     .OfType<InvocationExpressionSyntax>() |                     .OfType<InvocationExpressionSyntax>() | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ public class UseSpectreInsteadOfSystemConsoleAnalyzer : SpectreAnalyzer | |||||||
|  |  | ||||||
|                 var systemConsoleType = context.Compilation.GetTypeByMetadataName("System.Console"); |                 var systemConsoleType = context.Compilation.GetTypeByMetadataName("System.Console"); | ||||||
|  |  | ||||||
|                 if (!Equals(invocationOperation.TargetMethod.ContainingType, systemConsoleType)) |                 if (!SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, systemConsoleType)) | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -35,6 +35,11 @@ public class SwitchToAnsiConsoleAction : CodeAction | |||||||
|         var originalCaller = ((MemberAccessExpressionSyntax)_originalInvocation.Expression).Name.ToString(); |         var originalCaller = ((MemberAccessExpressionSyntax)_originalInvocation.Expression).Name.ToString(); | ||||||
|  |  | ||||||
|         var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); |         var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); | ||||||
|  |         if (syntaxTree == null) | ||||||
|  |         { | ||||||
|  |             return _document; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         var root = (CompilationUnitSyntax)await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); |         var root = (CompilationUnitSyntax)await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|         // If there is an ansiConsole passed into the method then we'll use it. |         // If there is an ansiConsole passed into the method then we'll use it. | ||||||
| @@ -66,7 +71,7 @@ public class SwitchToAnsiConsoleAction : CodeAction | |||||||
|             .Ancestors().OfType<MethodDeclarationSyntax>() |             .Ancestors().OfType<MethodDeclarationSyntax>() | ||||||
|             .First() |             .First() | ||||||
|             .ParameterList.Parameters |             .ParameterList.Parameters | ||||||
|             .FirstOrDefault(i => i.Type.NormalizeWhitespace().ToString() == "IAnsiConsole") |             .FirstOrDefault(i => i.Type?.NormalizeWhitespace()?.ToString() == "IAnsiConsole") | ||||||
|             ?.Identifier.Text; |             ?.Identifier.Text; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -79,7 +84,7 @@ public class SwitchToAnsiConsoleAction : CodeAction | |||||||
|             .Ancestors() |             .Ancestors() | ||||||
|             .OfType<MethodDeclarationSyntax>() |             .OfType<MethodDeclarationSyntax>() | ||||||
|             .First() |             .First() | ||||||
|             .Modifiers.Any(i => i.Kind() == SyntaxKind.StaticKeyword); |             .Modifiers.Any(i => i.IsKind(SyntaxKind.StaticKeyword)); | ||||||
|  |  | ||||||
|         return _originalInvocation |         return _originalInvocation | ||||||
|             .Ancestors().OfType<ClassDeclarationSyntax>() |             .Ancestors().OfType<ClassDeclarationSyntax>() | ||||||
| @@ -88,7 +93,7 @@ public class SwitchToAnsiConsoleAction : CodeAction | |||||||
|             .OfType<FieldDeclarationSyntax>() |             .OfType<FieldDeclarationSyntax>() | ||||||
|             .FirstOrDefault(i => |             .FirstOrDefault(i => | ||||||
|                 i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" && |                 i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" && | ||||||
|                 (!isStatic ^ i.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword))) |                 (!isStatic ^ i.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.StaticKeyword)))) | ||||||
|             ?.Declaration.Variables.First().Identifier.Text; |             ?.Declaration.Variables.First().Identifier.Text; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,9 +18,18 @@ public class StaticAnsiConsoleToInstanceFix : CodeFixProvider | |||||||
|     public override async Task RegisterCodeFixesAsync(CodeFixContext context) |     public override async Task RegisterCodeFixesAsync(CodeFixContext context) | ||||||
|     { |     { | ||||||
|         var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); |         var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); | ||||||
|         var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>(); |         if (root != null) | ||||||
|         context.RegisterCodeFix( |         { | ||||||
|             new SwitchToAnsiConsoleAction(context.Document, methodDeclaration, "Convert static AnsiConsole calls to local instance."), |             var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>(); | ||||||
|             context.Diagnostics); |             if (methodDeclaration != null) | ||||||
|  |             { | ||||||
|  |                 context.RegisterCodeFix( | ||||||
|  |                     new SwitchToAnsiConsoleAction( | ||||||
|  |                         context.Document, | ||||||
|  |                         methodDeclaration, | ||||||
|  |                         "Convert static AnsiConsole calls to local instance."), | ||||||
|  |                     context.Diagnostics); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -18,9 +18,18 @@ public class SystemConsoleToAnsiConsoleFix : CodeFixProvider | |||||||
|     public override async Task RegisterCodeFixesAsync(CodeFixContext context) |     public override async Task RegisterCodeFixesAsync(CodeFixContext context) | ||||||
|     { |     { | ||||||
|         var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); |         var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); | ||||||
|         var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>(); |         if (root != null) | ||||||
|         context.RegisterCodeFix( |         { | ||||||
|             new SwitchToAnsiConsoleAction(context.Document, methodDeclaration, "Convert static call to AnsiConsole to Spectre.Console.AnsiConsole"), |             var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>(); | ||||||
|             context.Diagnostics); |             if (methodDeclaration != null) | ||||||
|  |             { | ||||||
|  |                 context.RegisterCodeFix( | ||||||
|  |                     new SwitchToAnsiConsoleAction( | ||||||
|  |                         context.Document, | ||||||
|  |                         methodDeclaration, | ||||||
|  |                         "Convert static call to AnsiConsole to Spectre.Console.AnsiConsole"), | ||||||
|  |                     context.Diagnostics); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|     <PropertyGroup> |     <PropertyGroup> | ||||||
|         <Description>Best practice analyzers for Spectre.Console.</Description> |         <Description>Best practice analyzers for Spectre.Console.</Description> | ||||||
| @@ -15,9 +15,10 @@ | |||||||
|     </ItemGroup> |     </ItemGroup> | ||||||
|      |      | ||||||
|     <ItemGroup> |     <ItemGroup> | ||||||
|         <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" PrivateAssets="all" /> |         <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" /> | ||||||
|         <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" PrivateAssets="all" /> |         <PackageReference Include="Microsoft.CodeAnalysis" Version="4.2.0" PrivateAssets="all" /> | ||||||
|         <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" PrivateAssets="all" /> |         <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" PrivateAssets="all" /> | ||||||
|  |         <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" PrivateAssets="all" /> | ||||||
|     </ItemGroup> |     </ItemGroup> | ||||||
|      |      | ||||||
|     <ItemGroup> |     <ItemGroup> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks>net6.0;net5.0;netstandard2.0</TargetFrameworks> |     <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <IsPackable>true</IsPackable> |     <IsPackable>true</IsPackable> | ||||||
|     <NoWarn>SA1633</NoWarn> |     <NoWarn>SA1633</NoWarn> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks>net6.0;net5.0;netstandard2.0</TargetFrameworks> |     <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <IsPackable>true</IsPackable> |     <IsPackable>true</IsPackable> | ||||||
|     <Description>A library that extends Spectre.Console with ImageSharp superpowers.</Description> |     <Description>A library that extends Spectre.Console with ImageSharp superpowers.</Description> | ||||||
| @@ -13,7 +13,7 @@ | |||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="SixLabors.ImageSharp" Version="2.0.0" /> |     <PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks>net6.0;net5.0;netstandard2.0</TargetFrameworks> |     <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> | ||||||
|     <IsTestProject>false</IsTestProject> |     <IsTestProject>false</IsTestProject> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <IsPackable>true</IsPackable> |     <IsPackable>true</IsPackable> | ||||||
|   | |||||||
| @@ -1,14 +1,14 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks>net6.0;net5.0;netstandard2.0</TargetFrameworks> |     <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <IsPackable>true</IsPackable> |     <IsPackable>true</IsPackable> | ||||||
|     <NoWarn>SA1633</NoWarn> |     <NoWarn>SA1633</NoWarn> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="System.Memory" Version="4.5.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> |     <PackageReference Include="System.Memory" Version="4.5.5" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
| @@ -20,6 +20,7 @@ | |||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|  |     <PackageReference Include="System.Memory" Version="4.5.5" /> | ||||||
|     <PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" /> |     <PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" /> | ||||||
|     <PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[$(AnnotatedReferenceAssemblyVersion)]" /> |     <PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[$(AnnotatedReferenceAssemblyVersion)]" /> | ||||||
|     <PackageReference Include="Nullable" Version="1.3.0"> |     <PackageReference Include="Nullable" Version="1.3.0"> | ||||||
|   | |||||||
| @@ -6,10 +6,10 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup Label="Package References"> |   <ItemGroup Label="Package References"> | ||||||
|     <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.312"> |     <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435"> | ||||||
|       <PrivateAssets>All</PrivateAssets> |       <PrivateAssets>All</PrivateAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|     <PackageReference Include="Roslynator.Analyzers" Version="3.3.0"> |     <PackageReference Include="Roslynator.Analyzers" Version="4.1.1"> | ||||||
|       <PrivateAssets>All</PrivateAssets> |       <PrivateAssets>All</PrivateAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ internal static class CodeAnalyzerHelper | |||||||
|  |  | ||||||
|     static CodeAnalyzerHelper() |     static CodeAnalyzerHelper() | ||||||
|     { |     { | ||||||
|         CurrentSpectre = ReferenceAssemblies.Net.Net50.AddAssemblies( |         CurrentSpectre = ReferenceAssemblies.Net.Net60.AddAssemblies( | ||||||
|             ImmutableArray.Create(typeof(AnsiConsole).Assembly.Location.Replace(".dll", string.Empty))); |             ImmutableArray.Create(typeof(AnsiConsole).Assembly.Location.Replace(".dll", string.Empty))); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFramework>net5.0</TargetFramework> |     <TargetFramework>net6.0</TargetFramework> | ||||||
|     <IsPackable>false</IsPackable> |     <IsPackable>false</IsPackable> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
| @@ -10,12 +10,12 @@ | |||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" /> | ||||||
|     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> |     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" /> | ||||||
|     <PackageReference Include="xunit" Version="2.4.1" /> |     <PackageReference Include="xunit" Version="2.4.1" /> | ||||||
|     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||||||
|       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||||
|       <PrivateAssets>all</PrivateAssets> |       <PrivateAssets>all</PrivateAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|   | |||||||
| @@ -8,14 +8,6 @@ public static class SpectreAnalyzerVerifier<TAnalyzer> | |||||||
|  |  | ||||||
|     private static Task VerifyCodeFixAsync(string source, IEnumerable<DiagnosticResult> expected, string fixedSource) |     private static Task VerifyCodeFixAsync(string source, IEnumerable<DiagnosticResult> expected, string fixedSource) | ||||||
|     { |     { | ||||||
|         // Roslyn fixers always use \r\n for newlines, regardless of OS environment settings, so we normalize |  | ||||||
|         // the source as it typically comes from multi-line strings with varying newlines. |  | ||||||
|         if (Environment.NewLine != "\r\n") |  | ||||||
|         { |  | ||||||
|             source = source.Replace(Environment.NewLine, "\r\n"); |  | ||||||
|             fixedSource = fixedSource.Replace(Environment.NewLine, "\r\n"); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         var test = new Test |         var test = new Test | ||||||
|         { |         { | ||||||
|             TestCode = source, |             TestCode = source, | ||||||
|   | |||||||
| @@ -11,7 +11,6 @@ global using Spectre.Console.Cli; | |||||||
| global using Spectre.Console.Cli.Unsafe; | global using Spectre.Console.Cli.Unsafe; | ||||||
| global using Spectre.Console.Testing; | global using Spectre.Console.Testing; | ||||||
| global using Spectre.Console.Tests.Data; | global using Spectre.Console.Tests.Data; | ||||||
| global using Spectre.Verify.Extensions; |  | ||||||
| global using VerifyTests; | global using VerifyTests; | ||||||
| global using VerifyXunit; | global using VerifyXunit; | ||||||
| global using Xunit; | global using Xunit; | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net5.0;net48</TargetFrameworks> |     <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net48</TargetFrameworks> | ||||||
|     <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net5.0</TargetFrameworks> |     <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6.0</TargetFrameworks> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
| @@ -10,16 +10,16 @@ | |||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="IsExternalInit" Version="1.0.1" PrivateAssets="all" /> |     <PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="all" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" /> | ||||||
|     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> |     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" /> | ||||||
|     <PackageReference Include="Shouldly" Version="4.0.3" /> |     <PackageReference Include="Shouldly" Version="4.0.3" /> | ||||||
|     <PackageReference Include="Spectre.Verify.Extensions" Version="0.3.0" /> |     <PackageReference Include="Spectre.Verify.Extensions" Version="17.1.6" /> | ||||||
|     <PackageReference Include="Verify.Xunit" Version="9.0.0-beta.1" /> |     <PackageReference Include="Verify.Xunit" Version="17.1.6" /> | ||||||
|     <PackageReference Include="xunit" Version="2.4.1" /> |     <PackageReference Include="xunit" Version="2.4.1" /> | ||||||
|     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||||||
|       <PrivateAssets>all</PrivateAssets> |       <PrivateAssets>all</PrivateAssets> | ||||||
|       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
|   | |||||||
| @@ -13,7 +13,6 @@ global using Spectre.Console.Advanced; | |||||||
| global using Spectre.Console.Rendering; | global using Spectre.Console.Rendering; | ||||||
| global using Spectre.Console.Testing; | global using Spectre.Console.Testing; | ||||||
| global using Spectre.Console.Tests.Data; | global using Spectre.Console.Tests.Data; | ||||||
| global using Spectre.Verify.Extensions; |  | ||||||
| global using VerifyTests; | global using VerifyTests; | ||||||
| global using VerifyXunit; | global using VerifyXunit; | ||||||
| global using Xunit; | global using Xunit; | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net5.0;net48</TargetFrameworks> |     <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net48</TargetFrameworks> | ||||||
|     <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6.0;net5.0</TargetFrameworks> |     <TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6.0</TargetFrameworks> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
| @@ -12,16 +12,16 @@ | |||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="IsExternalInit" Version="1.0.1" PrivateAssets="all" /> |     <PackageReference Include="IsExternalInit" Version="1.0.2" PrivateAssets="all" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.0" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.0" /> | ||||||
|     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" /> |     <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" /> | ||||||
|     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> |     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" /> | ||||||
|     <PackageReference Include="Shouldly" Version="4.0.3" /> |     <PackageReference Include="Shouldly" Version="4.0.3" /> | ||||||
|     <PackageReference Include="Spectre.Verify.Extensions" Version="0.3.0" /> |     <PackageReference Include="Spectre.Verify.Extensions" Version="17.1.6" /> | ||||||
|     <PackageReference Include="Verify.Xunit" Version="9.0.0-beta.1" /> |     <PackageReference Include="Verify.Xunit" Version="17.1.6" /> | ||||||
|     <PackageReference Include="xunit" Version="2.4.1" /> |     <PackageReference Include="xunit" Version="2.4.1" /> | ||||||
|     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> |     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||||||
|       <PrivateAssets>all</PrivateAssets> |       <PrivateAssets>all</PrivateAssets> | ||||||
|       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||||||
|     </PackageReference> |     </PackageReference> | ||||||
| @@ -33,9 +33,4 @@ | |||||||
|     <ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" /> |     <ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Folder Include="Expectations\Widgets\Table\Rows\Extensions\" /> |  | ||||||
|     <Folder Include="Expectations\Widgets\Tree\" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|  |  | ||||||
| </Project> | </Project> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user