Not sure if this is a tooling issue, or difference in results from Roslyn caused by a runtime/designtime compilation difference. Example differences:  From: https://github.com/dotnet/razor/commit/f929020b391baae015ded4a723f4d773c5d105df?diff=unified&w=0#diff-a1706b971c83e9c0c358e3db52e305ad63a07dc5a88c23d2ae265ce9e06eaf54L30 I think this is a bad user experience as, in the example above, the closing `div` tag would end up displayed on the same line as the `@if` when collapsed.