Not sure if this is a tooling issue, or difference in results from Roslyn caused by a runtime/designtime compilation difference.
Example differences:

From:
f929020?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.