Add feature to convert from top-level-statements to Program.Main form#60383
Add feature to convert from top-level-statements to Program.Main form#60383JoeRobich merged 69 commits intodotnet:mainfrom
Conversation
src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertToProgramMainDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertToProgramMainDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertToProgramMainDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
| namespace Microsoft.CodeAnalysis.CSharp.ConvertProgram | ||
| { | ||
| [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.ConvertToProgramMain), Shared] | ||
| internal class ConvertToProgramMainCodeFixProvider : SyntaxEditorBasedCodeFixProvider |
There was a problem hiding this comment.
That should be in Analyzers layer.
There was a problem hiding this comment.
this matches the ConvertNamespace fixer work. we can move both over at the same time if appropriate.
There was a problem hiding this comment.
@CyrusNajmabadi This causes bugs like #45569
There are many codefixes that are misplaced in Features. I think it's better if future codefixes are placed properly making the future work to move everything to Analyzers more manageable.
There was a problem hiding this comment.
so, i'm amenable to that, but i think ti should be done as a general work item that also ensures that the analyzer/fixer layer has all the appropraite other extensions/modules needed to make that work.
src/Features/CSharp/Portable/ConvertProgram/ConvertProgramHelpers.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
…into programMain
…MainDiagnosticAnalyzer.cs Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
src/Features/CSharp/Portable/Formatting/CSharpUseProgramMainNewDocumentFormattingProvider.cs
Show resolved
Hide resolved
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CodeStyle/CSharpCodeStyleOptions.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/ConvertProgram/ConvertToProgramMainTests.cs
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/ConvertProgram/ConvertToProgramMainTests.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/ConvertProgram/ConvertToProgramMainTests.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/ConvertProgram/ConvertProgramHelpers.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/ConvertProgram/ConvertToProgramMainTests.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CodeStyle/CSharpCodeStyleOptions.cs
Outdated
Show resolved
Hide resolved
…sform_ProgramMain.cs Co-authored-by: David Wengier <david.wengier@microsoft.com>
Will do! |
677cfb6 to
62229fe
Compare
Comes with style option: csharp_style_prefer_top_level_statements
Looks like:
Todo: