From 8310b69d3858995b7df93b27caaeaa7be72ae953 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Thu, 30 Nov 2023 14:14:15 +0100 Subject: [PATCH 01/12] Remove analyzers from IDE extensions --- .github/workflows/build.yml | 4 - README.md | 2 +- .../EditorConfigCodeAnalysisConfig.cs | 13 +- .../EditorConfig/EditorConfigGenerator.cs | 130 +++++++++--------- src/Tools/CodeGenerator/Program.cs | 2 +- .../ConfigurationFileGenerator/Program.cs | 2 +- .../configuration.md | 11 +- src/VisualStudio/Overview.md | 15 +- .../source.extension.vsixmanifest | 22 +-- src/VisualStudioCode/package/README.md | 20 ++- src/VisualStudioCode/package/package.json | 3 +- 11 files changed, 104 insertions(+), 120 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6425fc70d6..59d751c789 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,10 +169,6 @@ jobs: cp bin/Release/netstandard2.0/Roslynator.Workspaces.Core.dll package/roslyn/common cp bin/Release/netstandard2.0/Roslynator.Workspaces.Common.dll package/roslyn/common cp bin/Release/netstandard2.0/Roslynator.CSharp.Workspaces.dll package/roslyn/common - cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.dll package/roslyn/analyzers - cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.CodeFixes.dll package/roslyn/analyzers - cp bin/Release/netstandard2.0/Roslynator.Formatting.Analyzers.dll package/roslyn/analyzers - cp bin/Release/netstandard2.0/Roslynator.Formatting.Analyzers.CodeFixes.dll package/roslyn/analyzers cp bin/Release/netstandard2.0/Roslynator.CSharp.Refactorings.dll package/roslyn/refactorings cp bin/Release/netstandard2.0/Roslynator.CSharp.CodeFixes.dll package/roslyn/fixes name: Copy DLLs to package diff --git a/README.md b/README.md index 8cb5cef6af..f0301158a8 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Roslynator is a set of code analysis tools for C#, powered by [Roslyn](https://g - [Open VSX](https://open-vsx.org/extension/josefpihrt-vscode/roslynator) - [NuGet packages](#nuget-packages) that contain collection of analyzers - [Roslynator.Analyzers](https://www.nuget.org/packages/Roslynator.Analyzers) - - [Roslynator.CodeAnalysis.Analyzers](https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers) - [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + - [Roslynator.CodeAnalysis.Analyzers](https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers) - [Testing framework](#testing-framework) that allows unit testing of analyzers, refactoring and code fixes - [.NET client libraries](#client-libraries) that extend Roslyn API - [Command line tool](#command-line-tool) diff --git a/src/Common/Configuration/EditorConfigCodeAnalysisConfig.cs b/src/Common/Configuration/EditorConfigCodeAnalysisConfig.cs index 82e450ab86..87d59e7d3d 100644 --- a/src/Common/Configuration/EditorConfigCodeAnalysisConfig.cs +++ b/src/Common/Configuration/EditorConfigCodeAnalysisConfig.cs @@ -19,20 +19,11 @@ internal class EditorConfigCodeAnalysisConfig is_global = true -# Options in this file can be used to change default configuration of analyzers, refactorings and compiler diagnostic fixes. +# Options in this file can be used to change default configuration of refactorings and compiler diagnostic fixes. +# Options can be used both in default configuration file (.roslynatorconfig) and in standard .editorconfig file. # Default configuration is loaded once when IDE starts. Therefore, it may be necessary to restart IDE for changes to take effect. # Full list of available options: https://josefpihrt.github.io/docs/roslynator/configuration -# Set severity for all analyzers that are enabled by default (https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#set-rule-severity-of-multiple-analyzer-rules-at-once-in-an-editorconfig-file) -dotnet_analyzer_diagnostic.category-roslynator.severity = default|none|silent|suggestion|warning|error - -# Enable/disable all analyzers by default. -# NOTE: This option can be used only in .roslynatorconfig file -roslynator_analyzers.enabled_by_default = true|false - -## Set severity for a specific analyzer -#dotnet_diagnostic..severity = default|none|silent|suggestion|warning|error - ## Enable/disable all refactorings #roslynator_refactorings.enabled = true|false diff --git a/src/Tools/CodeGeneration/EditorConfig/EditorConfigGenerator.cs b/src/Tools/CodeGeneration/EditorConfig/EditorConfigGenerator.cs index 1a4bfba0d2..251d9bb4af 100644 --- a/src/Tools/CodeGeneration/EditorConfig/EditorConfigGenerator.cs +++ b/src/Tools/CodeGeneration/EditorConfig/EditorConfigGenerator.cs @@ -12,88 +12,94 @@ namespace Roslynator.CodeGeneration.EditorConfig; public static class EditorConfigGenerator { - public static string GenerateEditorConfig(RoslynatorMetadata metadata, bool commentOut) + public static string GenerateEditorConfig(RoslynatorMetadata metadata, bool includeAnalyzers, bool commentOut) { var optionMap = new Dictionary>(); - foreach (AnalyzerMetadata analyzer in metadata.Analyzers) + if (includeAnalyzers) { - foreach (AnalyzerConfigOption option in analyzer.ConfigOptions) + foreach (AnalyzerMetadata analyzer in metadata.Analyzers) { - if (!optionMap.TryGetValue(option.Key, out HashSet optionAnalyzers)) - optionAnalyzers = new HashSet(); + foreach (AnalyzerConfigOption option in analyzer.ConfigOptions) + { + if (!optionMap.TryGetValue(option.Key, out HashSet optionAnalyzers)) + optionAnalyzers = new HashSet(); - optionAnalyzers.Add(analyzer); - optionMap[option.Key] = optionAnalyzers; + optionAnalyzers.Add(analyzer); + optionMap[option.Key] = optionAnalyzers; + } } } using (var w = new EditorConfigWriter(new StringWriter())) { - w.WriteLine(); - w.WriteLine("# Options"); - w.WriteLine(); - - var isSeparatedWithNewLine = true; - - foreach (AnalyzerOptionMetadata option in metadata.ConfigOptions - .Where(f => !f.IsObsolete) - .OrderBy(f => f.Key)) + if (includeAnalyzers) { - if (optionMap.TryGetValue(option.Key, out HashSet analyzers) - && !isSeparatedWithNewLine) - { - w.WriteLine(); - } - - w.WriteCommentCharIf(commentOut); - w.WriteEntry($"{option.Key}", option.DefaultValuePlaceholder); - - string defaultValue = option.DefaultValue; + w.WriteLine(); + w.WriteLine("# Options"); + w.WriteLine(); - if (defaultValue is not null) - w.WriteLine($"# Default: {defaultValue}"); + var isSeparatedWithNewLine = true; - if (analyzers?.Count > 0) + foreach (AnalyzerOptionMetadata option in metadata.ConfigOptions + .Where(f => !f.IsObsolete) + .OrderBy(f => f.Key)) { - w.WriteLine("# Applicable to: " + string.Join(", ", analyzers.OrderBy(f => f.Id).Select(f => f.Id.ToLowerInvariant()))); - w.WriteLine(); - isSeparatedWithNewLine = true; + if (optionMap.TryGetValue(option.Key, out HashSet analyzers) + && !isSeparatedWithNewLine) + { + w.WriteLine(); + } + + w.WriteCommentCharIf(commentOut); + w.WriteEntry($"{option.Key}", option.DefaultValuePlaceholder); + + string defaultValue = option.DefaultValue; + + if (defaultValue is not null) + w.WriteLine($"# Default: {defaultValue}"); + + if (analyzers?.Count > 0) + { + w.WriteLine("# Applicable to: " + string.Join(", ", analyzers.OrderBy(f => f.Id).Select(f => f.Id.ToLowerInvariant()))); + w.WriteLine(); + isSeparatedWithNewLine = true; + } + else + { + isSeparatedWithNewLine = false; + } } - else - { - isSeparatedWithNewLine = false; - } - } - - w.WriteLine(); - w.WriteLine("# Analyzers"); - w.WriteLine(); - foreach (AnalyzerMetadata analyzer in metadata.Analyzers - .Where(f => f.Status == AnalyzerStatus.Enabled && !f.Tags.Contains("HideFromConfiguration")) - .OrderBy(f => f.Id)) - { - w.WriteLine($"# {analyzer.Title.TrimEnd('.')}"); - w.WriteCommentCharIf(commentOut); - w.WriteAnalyzer( - analyzer.Id.ToLowerInvariant(), - (analyzer.IsEnabledByDefault) - ? ((DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), analyzer.DefaultSeverity)).ToReportDiagnostic() - : ReportDiagnostic.Suppress); + w.WriteLine(); + w.WriteLine("# Analyzers"); + w.WriteLine(); - if (analyzer.ConfigOptions.Count > 0) + foreach (AnalyzerMetadata analyzer in metadata.Analyzers + .Where(f => f.Status == AnalyzerStatus.Enabled && !f.Tags.Contains("HideFromConfiguration")) + .OrderBy(f => f.Id)) { - w.WriteLine("# Options: " - + string.Join( - ", ", - analyzer.ConfigOptions - .Where(f => metadata.ConfigOptions.FirstOrDefault(ff => ff.Key == f.Key)?.IsObsolete != true) - .OrderBy(f => f.Key) - .Select(f2 => metadata.ConfigOptions.First(f => f.Key == f2.Key).Key))); - } + w.WriteLine($"# {analyzer.Title.TrimEnd('.')}"); + w.WriteCommentCharIf(commentOut); + w.WriteAnalyzer( + analyzer.Id.ToLowerInvariant(), + (analyzer.IsEnabledByDefault) + ? ((DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), analyzer.DefaultSeverity)).ToReportDiagnostic() + : ReportDiagnostic.Suppress); + + if (analyzer.ConfigOptions.Count > 0) + { + w.WriteLine("# Options: " + + string.Join( + ", ", + analyzer.ConfigOptions + .Where(f => metadata.ConfigOptions.FirstOrDefault(ff => ff.Key == f.Key)?.IsObsolete != true) + .OrderBy(f => f.Key) + .Select(f2 => metadata.ConfigOptions.First(f => f.Key == f2.Key).Key))); + } - w.WriteLine(); + w.WriteLine(); + } } w.WriteLine(); diff --git a/src/Tools/CodeGenerator/Program.cs b/src/Tools/CodeGenerator/Program.cs index db4002e844..1fce852bac 100644 --- a/src/Tools/CodeGenerator/Program.cs +++ b/src/Tools/CodeGenerator/Program.cs @@ -113,7 +113,7 @@ private static void Main(string[] args) @"export const configurationFileContent = { roslynatorconfig: `" + EditorConfigCodeAnalysisConfig.FileDefaultContent - + EditorConfigGenerator.GenerateEditorConfig(metadata, commentOut: true) + + EditorConfigGenerator.GenerateEditorConfig(metadata, includeAnalyzers: false, commentOut: true) + @"` };", new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); diff --git a/src/Tools/ConfigurationFileGenerator/Program.cs b/src/Tools/ConfigurationFileGenerator/Program.cs index b7987a57ab..d2ddd81113 100644 --- a/src/Tools/ConfigurationFileGenerator/Program.cs +++ b/src/Tools/ConfigurationFileGenerator/Program.cs @@ -33,7 +33,7 @@ private static void Main(string[] args) configFileContent += @"# Full List of Options ```editorconfig title="".editorconfig""" - + EditorConfigGenerator.GenerateEditorConfig(metadata, commentOut: false) + + EditorConfigGenerator.GenerateEditorConfig(metadata, includeAnalyzers: true, commentOut: false) + @"``` "; diff --git a/src/Tools/ConfigurationFileGenerator/configuration.md b/src/Tools/ConfigurationFileGenerator/configuration.md index 9475566e83..63801c7743 100644 --- a/src/Tools/ConfigurationFileGenerator/configuration.md +++ b/src/Tools/ConfigurationFileGenerator/configuration.md @@ -6,13 +6,11 @@ Use EditorConfig file to configure analyzers, refactoring and compiler diagnosti # Set severity for all analyzers that are enabled by default (https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#set-rule-severity-of-multiple-analyzer-rules-at-once-in-an-editorconfig-file) dotnet_analyzer_diagnostic.category-roslynator.severity = default|none|silent|suggestion|warning|error -# Enable/disable all analyzers by default -# NOTE: This option can be used only in .roslynatorconfig file -roslynator_analyzers.enabled_by_default = true|false - # Set severity for a specific analyzer dotnet_diagnostic..severity = default|none|silent|suggestion|warning|error +# NOTE: Following options can be used both in .editorconfig file and in .roslynatorconfig file (see below): + # Enable/disable all refactorings roslynator_refactorings.enabled = true|false @@ -33,9 +31,7 @@ if an analyzer is enabled but required option is not set. ROS0003 is disabled by ## Default Configuration -If you want to configure Roslynator on a user-wide basis you have to use Roslynator config file (`.roslynatorconfig`). - -**IMPORTANT:** Default configuration file can be used only with VS extension or VS code extension. +Default configuration file can be used to configure Visual Studio extension or VS Code extension (refactorings and code fixes). ### Format @@ -44,7 +40,6 @@ Namely, file must contain top-level entry `is_global = true` and cannot contain ```ini is_global = true -roslynator_analyzers.enabled_by_default = true ``` ### Location diff --git a/src/VisualStudio/Overview.md b/src/VisualStudio/Overview.md index 4c1b32874f..c82e9c1260 100644 --- a/src/VisualStudio/Overview.md +++ b/src/VisualStudio/Overview.md @@ -1,19 +1,22 @@ ## Overview -* A collection of 500+ analyzers, refactorings and fixes for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +* A collection of refactorings and fixes for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). * [Project website](https://github.com/dotnet/roslynator) -* [List of analyzers](https://josefpihrt.github.io/docs/roslynator/analyzers) * [List of refactorings](https://josefpihrt.github.io/docs/roslynator/refactorings) * [List of code fixes for CS diagnostics](https://josefpihrt.github.io/docs/roslynator/fixes) * [Release notes](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) -## Donation +## Analyzers -Although Roslynator is free of charge, any [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BX85UA346VTN6) is welcome and supports further development. +It' recommended to also use Roslynator analyzers to improve code quality. +To use Roslynator analyzers, install following NuGet packages to a project/solution: -## Related Products +- [Roslynator.Analyzers](https://www.nuget.org/packages/Roslynator.Analyzers) +- [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) -* Package [Roslynator.Analyzers](http://www.nuget.org/packages/Roslynator.Analyzers/) contains only analyzers. +## Donation + +Although Roslynator is free of charge, any [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BX85UA346VTN6) is welcome and supports further development. ## Documentation diff --git a/src/VisualStudio/source.extension.vsixmanifest b/src/VisualStudio/source.extension.vsixmanifest index e4b3f5e493..e0f1558c2f 100644 --- a/src/VisualStudio/source.extension.vsixmanifest +++ b/src/VisualStudio/source.extension.vsixmanifest @@ -3,32 +3,32 @@ Roslynator 2022 - A collection of 500+ analyzers, refactorings and fixes for C#, powered by Roslyn. + A collection of refactorings and fixes for C#, powered by Roslyn. https://github.com/dotnet/roslynator LICENSE.txt https://github.com/dotnet/roslynator/blob/main/ChangeLog.md roslynator-logo-small.png roslynator-logo-large.png - Roslyn;Refactoring;Analyzer;CodeAnalysis;C#;CSharp;Productivity;Diagnostic + Roslyn;Refactoring;CodeAnalysis;C#;CSharp;Productivity;Diagnostic amd64 - arm64 + arm64 amd64 - arm64 + arm64 amd64 - arm64 + arm64 @@ -36,24 +36,12 @@ - - - - - - - - - - - - diff --git a/src/VisualStudioCode/package/README.md b/src/VisualStudioCode/package/README.md index 16fc273e84..04af3cecee 100644 --- a/src/VisualStudioCode/package/README.md +++ b/src/VisualStudioCode/package/README.md @@ -1,9 +1,17 @@ # Roslynator for Visual Studio Code -A collection of 500+ [analyzers](https://josefpihrt.github.io/docs/roslynator/analyzers), [refactorings](https://josefpihrt.github.io/docs/roslynator/refactorings) and [fixes](https://josefpihrt.github.io/docs/roslynator/fixes) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +A collection of [refactorings](https://josefpihrt.github.io/docs/roslynator/refactorings) and [fixes](https://josefpihrt.github.io/docs/roslynator/fixes) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). For further information please visit Roslynator [repo](https://github.com/dotnet/roslynator). +## Analyzers + +It' recommended to also use Roslynator analyzers to improve code quality. +To use Roslynator analyzers, install following NuGet packages to a project/solution: + +- [Roslynator.Analyzers](https://www.nuget.org/packages/Roslynator.Analyzers) +- [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + ## Configuration Use EditorConfig file to configure analyzers, refactoring and compiler diagnostic fixes. @@ -12,13 +20,11 @@ Use EditorConfig file to configure analyzers, refactoring and compiler diagnosti # Set severity for all analyzers that are enabled by default (https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#set-rule-severity-of-multiple-analyzer-rules-at-once-in-an-editorconfig-file) dotnet_analyzer_diagnostic.category-roslynator.severity = default|none|silent|suggestion|warning|error -# Enable/disable all analyzers by default. -# NOTE: This option can be used only in .roslynatorconfig file -roslynator_analyzers.enabled_by_default = true|false - # Set severity for a specific analyzer dotnet_diagnostic..severity = default|none|silent|suggestion|warning|error +# NOTE: Following options can be used both in .editorconfig file and in .roslynatorconfig file (see below): + # Enable/disable all refactorings roslynator_refactorings.enabled = true|false @@ -36,7 +42,7 @@ Full list of available options is [here](https://josefpihrt.github.io/docs/rosly ## Default Configuration -If you want to configure Roslynator on a user-wide basis you have to use Roslynator config file. +Default configuration file can be used to configure Visual Studio extension or VS Code extension (refactorings and code fixes). How to open config file: @@ -59,7 +65,7 @@ Default configuration is loaded once when IDE starts. Therefore, it may be neces ## Requirements -This extension requires [C# for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) 1.21.13 or higher. +This extension requires [C# for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) 1.21.13 or higher. ## Donation diff --git a/src/VisualStudioCode/package/package.json b/src/VisualStudioCode/package/package.json index 7c203ba439..191d920d87 100644 --- a/src/VisualStudioCode/package/package.json +++ b/src/VisualStudioCode/package/package.json @@ -2,7 +2,7 @@ "name": "roslynator", "publisher": "josefpihrt-vscode", "displayName": "Roslynator", - "description": "A collection of 500+ analyzers, refactorings and fixes for C#, powered by Roslyn.", + "description": "A collection of refactorings and fixes for C#, powered by Roslyn.", "icon": "images/icon.png", "version": "1.0.0", "author": "Josef Pihrt", @@ -52,7 +52,6 @@ "onCommand:csharp.listRemoteProcess", "onCommand:csharp.listRemoteDockerProcess", "onCommand:omnisharp.registerLanguageMiddleware", - "onCommand:roslynator.openDefaultConfigurationFile", "workspaceContains:project.json", "workspaceContains:**/*.{csproj,sln,slnf,csx,cake}" ], From b2df85df7e212e2092882c1db97a008cc7b7cd4a Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Thu, 30 Nov 2023 14:16:07 +0100 Subject: [PATCH 02/12] update --- tools/generate_configuration_file.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_configuration_file.ps1 b/tools/generate_configuration_file.ps1 index f5047f77cc..e82b7d9163 100644 --- a/tools/generate_configuration_file.ps1 +++ b/tools/generate_configuration_file.ps1 @@ -1,4 +1,4 @@ -dotnet restore "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --force +dotnet restore "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --force dotnet build "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --no-restore /p:Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors="1591,RS1024,RS1025,RS1026" if(!$?) { Read-Host; Exit } From 5182c17d9890132becb1d66e023396cf6b0df8b5 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Thu, 30 Nov 2023 14:16:19 +0100 Subject: [PATCH 03/12] update --- tools/generate_configuration_file.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_configuration_file.ps1 b/tools/generate_configuration_file.ps1 index e82b7d9163..f5047f77cc 100644 --- a/tools/generate_configuration_file.ps1 +++ b/tools/generate_configuration_file.ps1 @@ -1,4 +1,4 @@ -dotnet restore "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --force +dotnet restore "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --force dotnet build "$PSScriptRoot/../src/Tools/ConfigurationFileGenerator/ConfigurationFileGenerator.csproj" --no-restore /p:Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors="1591,RS1024,RS1025,RS1026" if(!$?) { Read-Host; Exit } From 22907e00405828d54129f16d0e232eecf5bcacc7 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sun, 3 Dec 2023 08:44:09 +0100 Subject: [PATCH 04/12] update --- src/VisualStudio/VisualStudio.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/VisualStudio/VisualStudio.csproj b/src/VisualStudio/VisualStudio.csproj index 8e442b186d..06dbeb9962 100644 --- a/src/VisualStudio/VisualStudio.csproj +++ b/src/VisualStudio/VisualStudio.csproj @@ -43,15 +43,11 @@ - - - - From 3e9c2ea8848f50c3bfc872a8dbebae5eada4cc5e Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Tue, 5 Dec 2023 14:46:32 +0100 Subject: [PATCH 05/12] update --- src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs b/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs index 315d2f5a8f..cf1e47132c 100644 --- a/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs +++ b/src/Tools/CodeGeneration/Markdown/MarkdownGenerator.cs @@ -259,13 +259,6 @@ static IEnumerable CreateAppliesTo(AnalyzerMetadata analyzer) { yield return Heading2("Applies to"); - if (!analyzer.Id.StartsWith("RCS9")) - { - yield return BulletItem(Link("Extension for VS 2022", "https://marketplace.visualstudio.com/items?itemName=josefpihrt.Roslynator2022")); - yield return BulletItem(Link("Extension for VS Code", "https://marketplace.visualstudio.com/items?itemName=josefpihrt-vscode.roslynator")); - yield return BulletItem(Link("Extension for Open VSX", "https://open-vsx.org/extension/josefpihrt-vscode/roslynator")); - } - if (analyzer.Id.StartsWith("RCS0")) yield return BulletItem(Link(new[] { "Package ", "Roslynator.Formatting.Analyzers" }, "https://www.nuget.org/packages/Roslynator.Formatting.Analyzers")); From 4bb7b01a3b12f7ccfa5907b46bd49d286c112686 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Wed, 20 Dec 2023 12:54:07 +0100 Subject: [PATCH 06/12] update --- .github/workflows/build.yml | 63 ++++++++++++++++++- src/VisualStudio/VisualStudio.csproj | 14 +++++ ...urce.extension-with-analyzers.vsixmanifest | 61 ++++++++++++++++++ 3 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 src/VisualStudio/source.extension-with-analyzers.vsixmanifest diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fc33ff9c3..7ecdf9b130 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -131,7 +131,7 @@ jobs: - uses: actions/checkout@v3 - run: (Get-Content source.extension.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension.vsixmanifest - run: dotnet restore - - uses: microsoft/setup-msbuild@v1.1 + - uses: microsoft/setup-msbuild@v1.3.1 - run: msbuild -m - uses: actions/upload-artifact@v3 with: @@ -146,6 +146,27 @@ jobs: name: vs_extension path: src/VisualStudio/Overview.md + build_vs_extension_with_analyzers: + if: github.ref_type != 'tag' || startsWith(github.ref_name, 'v') + needs: pre_build + runs-on: windows-latest + env: + Version: ${{ needs.pre_build.outputs.version }} + DeployExtension: false + defaults: + run: + working-directory: src/VisualStudio + steps: + - uses: actions/checkout@v3 + - run: (Get-Content source.extension-with-analyzers.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension-with-analyzers.vsixmanifest + - run: dotnet restore + - uses: microsoft/setup-msbuild@v1.3.1 + - run: msbuild -m /p:RoslynatorExtensionWithAnalyzers=true + - uses: actions/upload-artifact@v3 + with: + name: vs_extension_with_analyzers + path: src/VisualStudio/bin/Release/net472/*.vsix + build_vs_code_extension: if: github.ref_type != 'tag' || startsWith(github.ref_name, 'v') needs: [ pre_build, build_analyzers ] @@ -192,6 +213,46 @@ jobs: name: ovsx_extension path: src/VisualStudioCode/package/*.vsix + build_vs_code_extension_with_analyzers: + if: github.ref_type != 'tag' || startsWith(github.ref_name, 'v') + needs: [ pre_build, build_analyzers ] + runs-on: ubuntu-22.04 + env: + Version: ${{ needs.pre_build.outputs.version }} + defaults: + run: + working-directory: src/VisualStudioCode + steps: + - uses: actions/checkout@v3 + - run: dotnet restore + - run: dotnet build --no-restore /p:DefineConstants=VSCODE + - run: | + mkdir package/roslyn/analyzers + mkdir package/roslyn/refactorings + mkdir package/roslyn/fixes + cp bin/Release/netstandard2.0/Roslynator.Core.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.Common.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.CSharp.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.Workspaces.Core.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.Workspaces.Common.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.CSharp.Workspaces.dll package/roslyn/common + cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.dll package/roslyn/analyzers + cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.CodeFixes.dll package/roslyn/analyzers + cp bin/Release/netstandard2.0/Roslynator.CSharp.Refactorings.dll package/roslyn/refactorings + cp bin/Release/netstandard2.0/Roslynator.CSharp.CodeFixes.dll package/roslyn/fixes + name: Copy DLLs to package + - run: > + sed -i 's/"version": "1.0.0"/"version": "${{ needs.pre_build.outputs.version3 }}"/' package/package.json + - run: npm install + working-directory: src/VisualStudioCode/package + - run: npm install -g @vscode/vsce + - run: vsce package + working-directory: src/VisualStudioCode/package + - uses: actions/upload-artifact@v3 + with: + name: vs_code_extension_with_analyzers + path: src/VisualStudioCode/package/*.vsix + build_core_cli: if: github.ref_type != 'tag' || startsWith(github.ref_name, 'cli-v') needs: pre_build diff --git a/src/VisualStudio/VisualStudio.csproj b/src/VisualStudio/VisualStudio.csproj index 06dbeb9962..727ab6c7d0 100644 --- a/src/VisualStudio/VisualStudio.csproj +++ b/src/VisualStudio/VisualStudio.csproj @@ -53,6 +53,20 @@ + + + + + Designer + + + + + + Designer + + + diff --git a/src/VisualStudio/source.extension-with-analyzers.vsixmanifest b/src/VisualStudio/source.extension-with-analyzers.vsixmanifest new file mode 100644 index 0000000000..319be0f5d2 --- /dev/null +++ b/src/VisualStudio/source.extension-with-analyzers.vsixmanifest @@ -0,0 +1,61 @@ + + + + + Roslynator 2022 + A collection of refactorings and fixes for C#, powered by Roslyn. + https://github.com/dotnet/roslynator + LICENSE.txt + https://github.com/dotnet/roslynator/blob/main/ChangeLog.md + roslynator-logo-small.png + roslynator-logo-large.png + Roslyn;Refactoring;CodeAnalysis;C#;CSharp;Productivity;Diagnostic + + + + amd64 + + + arm64 + + + amd64 + + + arm64 + + + amd64 + + + arm64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1b04d63ed2ef78d2ff00c92d92a9b90a22a0ca95 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Wed, 20 Dec 2023 13:02:26 +0100 Subject: [PATCH 07/12] update --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ecdf9b130..adc28aa9b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,6 +153,7 @@ jobs: env: Version: ${{ needs.pre_build.outputs.version }} DeployExtension: false + RoslynatorExtensionWithAnalyzers: true defaults: run: working-directory: src/VisualStudio @@ -161,7 +162,7 @@ jobs: - run: (Get-Content source.extension-with-analyzers.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension-with-analyzers.vsixmanifest - run: dotnet restore - uses: microsoft/setup-msbuild@v1.3.1 - - run: msbuild -m /p:RoslynatorExtensionWithAnalyzers=true + - run: msbuild -m - uses: actions/upload-artifact@v3 with: name: vs_extension_with_analyzers From e8cfebdf4c5b2af606d6376f0f6b5d2c44161447 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Wed, 20 Dec 2023 13:20:50 +0100 Subject: [PATCH 08/12] update --- src/VisualStudio/VisualStudio.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/VisualStudio/VisualStudio.csproj b/src/VisualStudio/VisualStudio.csproj index 727ab6c7d0..58b31d1b19 100644 --- a/src/VisualStudio/VisualStudio.csproj +++ b/src/VisualStudio/VisualStudio.csproj @@ -84,9 +84,6 @@ true - - Designer - From ecb6155ca9dc0885839bbb30ae9281e14a2754c7 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Tue, 9 Jan 2024 21:27:25 +0100 Subject: [PATCH 09/12] update --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04bd67da4b..6d9f17e358 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -228,7 +228,7 @@ jobs: steps: - uses: actions/checkout@v3 - run: dotnet restore - - run: dotnet build --no-restore /p:DefineConstants=VSCODE + - run: dotnet build --no-restore - run: | mkdir package/roslyn/analyzers mkdir package/roslyn/refactorings From 194ba3b21c3c1efce9c73fa0cc1ac7751c065e62 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Sun, 4 Feb 2024 23:31:50 +0100 Subject: [PATCH 10/12] update --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cef1a5e802..0185f66e3d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -210,12 +210,12 @@ jobs: run: working-directory: src/VisualStudio steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: (Get-Content source.extension-with-analyzers.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension-with-analyzers.vsixmanifest - run: dotnet restore - - uses: microsoft/setup-msbuild@v1.3.1 + - uses: microsoft/setup-msbuild@v1.3 - run: msbuild -m - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: vs_extension_with_analyzers path: src/VisualStudio/bin/Release/net472/*.vsix @@ -276,7 +276,7 @@ jobs: run: working-directory: src/VisualStudioCode steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: dotnet restore - run: dotnet build --no-restore - run: | @@ -301,7 +301,7 @@ jobs: - run: npm install -g @vscode/vsce - run: vsce package working-directory: src/VisualStudioCode/package - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: vs_code_extension_with_analyzers path: src/VisualStudioCode/package/*.vsix From 6532f8dae0a0fe72ee91ec1aa1b0a2e193c346bb Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Mon, 5 Feb 2024 00:38:06 +0100 Subject: [PATCH 11/12] update --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0185f66e3d..d6ad191eea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,7 +178,7 @@ jobs: - uses: actions/checkout@v4 - run: (Get-Content source.extension.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension.vsixmanifest - run: dotnet restore - - uses: microsoft/setup-msbuild@v1.3 + - uses: upload-artifact@v4microsoft/setup-msbuild@v2 - run: msbuild -m - uses: actions/upload-artifact@v4 with: @@ -213,7 +213,7 @@ jobs: - uses: actions/checkout@v4 - run: (Get-Content source.extension-with-analyzers.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension-with-analyzers.vsixmanifest - run: dotnet restore - - uses: microsoft/setup-msbuild@v1.3 + - uses: upload-artifact@v4microsoft/setup-msbuild@v2 - run: msbuild -m - uses: actions/upload-artifact@v4 with: From a2e1eceb2842a175b0562100eea393bf881c6bd8 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Mon, 5 Feb 2024 13:12:01 +0100 Subject: [PATCH 12/12] update --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6ad191eea..5fc74cf50e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,7 +178,7 @@ jobs: - uses: actions/checkout@v4 - run: (Get-Content source.extension.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension.vsixmanifest - run: dotnet restore - - uses: upload-artifact@v4microsoft/setup-msbuild@v2 + - uses: microsoft/setup-msbuild@v2 - run: msbuild -m - uses: actions/upload-artifact@v4 with: @@ -213,7 +213,7 @@ jobs: - uses: actions/checkout@v4 - run: (Get-Content source.extension-with-analyzers.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.pre_build.outputs.version3 }}"' | Set-Content source.extension-with-analyzers.vsixmanifest - run: dotnet restore - - uses: upload-artifact@v4microsoft/setup-msbuild@v2 + - uses: microsoft/setup-msbuild@v2 - run: msbuild -m - uses: actions/upload-artifact@v4 with: