razor icon indicating copy to clipboard operation
razor copied to clipboard

Desired Razor Formatting changes

Open StevenTCramer opened this issue 2 years ago • 6 comments

  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 [email protected]></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 [email protected]></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)

StevenTCramer avatar Mar 08 '23 13:03 StevenTCramer

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>

mrpmorris avatar Mar 08 '23 14:03 mrpmorris

  1. Respect .editorconfig settings.

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

StevenTCramer avatar Mar 10 '23 11:03 StevenTCramer

👍 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.

davidwengier avatar Mar 11 '23 05:03 davidwengier