Skip to content

Keep leading trivia inside Main method…#61178

Merged
CyrusNajmabadi merged 2 commits into
dotnet:mainfrom
DoctorKrolic:keep-leading-trivia-inside-main
May 16, 2022
Merged

Keep leading trivia inside Main method…#61178
CyrusNajmabadi merged 2 commits into
dotnet:mainfrom
DoctorKrolic:keep-leading-trivia-inside-main

Conversation

@DoctorKrolic

Copy link
Copy Markdown
Contributor

…if it is more likely to be a statement comment rather than a file header when converting to 'Program.Main' style program

Fixes: #61126

@DoctorKrolic DoctorKrolic requested a review from a team as a code owner May 8, 2022 12:27
@ghost ghost added Community The pull request was submitted by a contributor who is not a Microsoft employee. Area-IDE labels May 8, 2022
@davidwengier

davidwengier commented May 8, 2022

Copy link
Copy Markdown
Member

Ignoring the fact that I think the assertion of this PR is tenuous at best, I would definitely want to see a test that sets the file_header value in .editorconfig to something, to ensure that does not move, otherwise this refactoring would just immediately trigger a diagnostic. Also I think the best thing would be not moving the trivia if file_header has a value at all, rather than trying to be smart about it, as I doubt its worth trying to put in the smarts to handle the file header plus some other trivia and split them up etc.

@DoctorKrolic

Copy link
Copy Markdown
Contributor Author

Closing this PR. I am not familiar with .editorconfig options and the way I can access them inside refactoring provider, so I feel I cannot implement the fix properly.

@DoctorKrolic DoctorKrolic deleted the keep-leading-trivia-inside-main branch May 15, 2022 15:53
@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

@DoctorKrolic are you ok if I push to your branch?

@DoctorKrolic

Copy link
Copy Markdown
Contributor Author

@CyrusNajmabadi Here 100% ok. I spent about half an hour trying to figure out how to get code style options and didn't find a way in the end. It would be interesting for me to know the answer)

@DoctorKrolic DoctorKrolic restored the keep-leading-trivia-inside-main branch May 15, 2022 17:21
@DoctorKrolic DoctorKrolic reopened this May 15, 2022
@CyrusNajmabadi CyrusNajmabadi changed the title Keep leadin trivia inside Main method… Keep leading trivia inside Main method… May 15, 2022
@CyrusNajmabadi CyrusNajmabadi enabled auto-merge May 15, 2022 19:30
…atement comment rather than a file header when converting to 'Program.Main' style program
@CyrusNajmabadi

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 4 pipeline(s).

@CyrusNajmabadi CyrusNajmabadi merged commit 2731a16 into dotnet:main May 16, 2022
@ghost ghost added this to the Next milestone May 16, 2022
@DoctorKrolic DoctorKrolic deleted the keep-leading-trivia-inside-main branch May 16, 2022 18:51
@Cosifne Cosifne modified the milestones: Next, 17.3 P2 May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert to 'Program.Main' style program should keep leading trivia inside Main method

4 participants