-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to convert from top-level-statements to Program.Main form #60383
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be in Analyzers
layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this matches the ConvertNamespace fixer work. we can move both over at the same time if appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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
Outdated
Show resolved
Hide resolved
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CodeStyle/CSharpCodeStyleOptions.cs
Outdated
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/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: