Keep trailing trivia so single line if statements don't get badly formatted#53414
Conversation
|
|
||
| newStatement = newStatement.WithAdditionalAnnotations(Formatter.Annotation); | ||
| newStatement = newStatement.WithAdditionalAnnotations(Formatter.Annotation) | ||
| .WithTrailingTrivia(ifStatement.GetTrailingTrivia()); |
There was a problem hiding this comment.
this might need to append, as opposed to 'With'. As thsi might blow away trivia that hte user had before which we wanted to keep, right?
There was a problem hiding this comment.
Can do. Do we have any helpers for skipping whitespace EndOfLine trivia when doing this?
There was a problem hiding this comment.
Couldn't find one.. let me know if you think its worth adding to SyntaxTriviaListExtensions
There was a problem hiding this comment.
Couldn't find one.. let me know if you think its worth adding to SyntaxTriviaListExtensions
It really depends. if it's something you will use in several differnt features, sure. But in general, i don't like one-off extensions that aren't used in multiple places getting put into our Extensions types.
There was a problem hiding this comment.
Yeah, thats fair (and I agree). I think I was tripped up by EndOfLine not being whitespace and there is a SkipLeadingWhitespace() extension method.
Though having said that, auto-merge has made the conversation moot it in this case :)
…vice-featureslayer * upstream/main: (857 commits) Update contrib documentation (dotnet#53504) SImplify Fix out of bound crash in lsp navto. Revert changes to TypeScriptWaitContext wrappers Switch to ROSLYN_TEST_CI for CI detection SImplify Simplify LoggerTestChannel using BlockingCollection Only require telemetry validation in CI Fix out of bound crash in lsp navto. Fix locked comment Update Compiler Test Plan.md (dotnet#53420) Adjust doc comment for NullableWalker.VisitConversion (dotnet#53429) Revert "Infer delegate types with -langversion:preview only (dotnet#53241)" (dotnet#53466) Fix syntax normalizer to add space around before colon in constructor initializer (dotnet#53326) Remove unnecessary property (dotnet#53406) EnC - Tell the debugger about updated type def tokens (dotnet#53217) Revert an error Update PublishData.json Keep trailing trivia so single line if statements don't get badly formatted (dotnet#53414) Fix dead test code (dotnet#53416) ...
Fixes #51563