dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
506 stars 196 forks source link

Desired Razor Formatting changes #8413

Open StevenTCramer opened 1 year ago

StevenTCramer commented 1 year ago
  1. Be able to stop aligning to the right.

Here is a sample of how I like to format.

<SfGrid DataSource=@Contacts AllowPaging=true Toolbar=@Toolbaritems>
    <Syncfusion.Blazor.Data.SfDataManager Json=@Contacts></Syncfusion.Blazor.Data.SfDataManager>
    <GridEvents CommandClicked=OnCommandClicked TValue=ContactDto> </GridEvents>
    <GridEditSettings AllowAdding=true AllowDeleting=true AllowEditing=true Mode=@EditMode.Dialog></GridEditSettings>
    <GridColumns>
        <GridColumn Field=@nameof(ContactDto.FirstName) HeaderText="First Name"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.LastName) HeaderText="Last Name"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.Email) HeaderText="Email"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.Phone) HeaderText="Phone"></GridColumn>
        <GridColumn HeaderText="Actions" TextAlign=TextAlign.Center Width="150">
            <GridCommandColumns>
                <GridCommandColumn 
                    ButtonOption=@(new CommandButtonOptions() { IconCss ="e-icons e-edit"})
                    Title="Edit" 
                />
                <GridCommandColumn 
                    ButtonOption=@(new CommandButtonOptions() { IconCss="e-icons e-delete"})
                    Title="Delete">
                </GridCommandColumn>
            </GridCommandColumns>
        </GridColumn>
    </GridColumns>
</SfGrid>

But currently the formatter will change this to the following.

<SfGrid DataSource=@Contacts AllowPaging=true Toolbar=@Toolbaritems>
    <Syncfusion.Blazor.Data.SfDataManager Json=@Contacts></Syncfusion.Blazor.Data.SfDataManager>
    <GridEvents CommandClicked=OnCommandClicked TValue=ContactDto> </GridEvents>
    <GridEditSettings AllowAdding=true AllowDeleting=true AllowEditing=true Mode=@EditMode.Dialog></GridEditSettings>
    <GridColumns>
        <GridColumn Field=@nameof(ContactDto.FirstName) HeaderText="First Name"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.LastName) HeaderText="Last Name"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.Email) HeaderText="Email"></GridColumn>
        <GridColumn Field=@nameof(ContactDto.Phone) HeaderText="Phone"></GridColumn>
        <GridColumn HeaderText="Actions" TextAlign=TextAlign.Center Width="150">
            <GridCommandColumns>
                <GridCommandColumn ButtonOption=@(new CommandButtonOptions() { IconCss ="e-icons e-edit"})
                                   Title="Edit" />
                <GridCommandColumn ButtonOption=@(new CommandButtonOptions() { IconCss="e-icons e-delete"})
                                   Title="Delete">
                </GridCommandColumn>
            </GridCommandColumns>
        </GridColumn>
    </GridColumns>
</SfGrid>

https://www.loom.com/share/e1f8b29ca5b8471d91486252e7f03822

  1. be able to stop quotes being inserted after entering =

https://www.loom.com/share/5e581760aac841b789889099e747da98

  1. Be able to turn off all formatting. (For times when it just doesn't do what the user wants)
mrpmorris commented 1 year ago

3 will be good for me, because I like to double-indent parameters when the control has child elements

<MyControl @ref=abc
        A=1
        B=2
        C=3>
    <ChildThing/>
</MyControl>
StevenTCramer commented 1 year ago
  1. Respect .editorconfig settings.

https://www.loom.com/share/9e7e193541f24005a1a2729029986efc

davidwengier commented 1 year ago

👍 turning off auto format on type is tracked by https://github.com/dotnet/razor/issues/4336 (and completed in 17.6!) 👍 .editorconfig support is tracked by https://github.com/dotnet/razor/issues/4406

Thanks for the feedback. Feel free to log as many new issues as you like, it is easier for us to track things separately than in one big issue.