fsprojects-archive / zzarchive-VisualFSharpPowerTools

[ARCHIVED] Power commands for F# in Visual Studio
http://fsprojects.github.io/VisualFSharpPowerTools/
Apache License 2.0
310 stars 77 forks source link

Provide a way to change a record written in one line to a multi-line representation #1487

Closed TeaDrivenDev closed 7 years ago

TeaDrivenDev commented 7 years ago

Description

There should be a way to easily "transpose" a record written on one line into the equivalent multi-line representation.

Short records are often written in one line like

{ Id = 2; Name = "Thing"; IsRelevant = true }

Later changes often make it necessary to change the representation to span multiple lines:

{
    Id = 2
    Name = "Thing"
    IsRelevant = true
}

Depending on the size of the record (and possibly local circumstances in the code), this requires quite a bit of fiddly and mechanical work for navigation, indentation and removing the semicolons.

Expected behavior

When the caret is on the opening brace of a record, detect if the whole record declaration is on one line.

If so, provide a light bulb suggestion to transform the record into a multi-line representation.

Transforming a multi-line record into a single-line representation should be similarly easy, but only under the condition that each of its fields is defined in exactly one line. If that can be reliably detected, an equivalent light bulb suggestion could be displayed on the opening brace of the respective record declarations.