Skip to content

Port 'Top Level Statements' code style PR to 17.3#60426

Merged
CyrusNajmabadi merged 72 commits intodotnet:release/dev17.3from
CyrusNajmabadi:programMain2
Mar 29, 2022
Merged

Port 'Top Level Statements' code style PR to 17.3#60426
CyrusNajmabadi merged 72 commits intodotnet:release/dev17.3from
CyrusNajmabadi:programMain2

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Mar 28, 2022

Provides a user facing option in VS to control preferences around top-level-statements. Looks like:

image

or

image

When set to prefer 'Program.Main' style, if a new project is created using a template that uses top-level-statements, then we will convert that template to use the traditional style like so:

image

This preference is also exposed through our standard analyzer/fixer/refactoring system so it can be used to change code after a project has already been created. For example an existing Program.Main program can be converted to a top-level-statement program (if viable):

image

Likewise, all top-level-statement programs can be converted back to a traditional Program.Main program:

image

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 28, 2022 22:49
@ghost ghost added the Area-IDE label Mar 28, 2022
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Already signed off in: #60383


public const string RemoveUnnecessaryLambdaExpressionDiagnosticId = "IDE0200";

public const string ForEachCastDiagnosticId = "IDE0210";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

intentionally taking this ID. if we back port this dev17.2, we want to keep these IDEs the same there.


# IDE0110
dotnet_diagnostic.IDE0110.severity = %value%

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorting, how does it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants