dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 667 forks source link

Fluent c# format document #7050

Closed JavierMarcuzzi closed 1 week ago

JavierMarcuzzi commented 5 months ago

Markup

CommunityToolkit.Maui.Markup use fluent, but the format document option doesn't accommodate the code, it would be nice that it accommodates as in pure c#.

Describe the solution you would like

Work as pure c#.

Applicable Scenarios

Net maui?

dibarbet commented 4 months ago

Format document should respect an .editorconfig, where you can configure how formatting behaves. See https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

If something is not working, please provide an example of the original code, how it gets formatted, your editorconfig, and how you expect it to be formatted.

JavierMarcuzzi commented 4 months ago

Thank you very much, but I don't have the knowledge to perform at that level of configuration. I use the options without touching the settings.

About an example, it can be this original, from https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup

using static CommunityToolkit.Maui.Markup.GridRowsColumns;

class SampleContentPage : ContentPage { public SampleContentPage() { Content = new Grid { RowDefinitions = Rows.Define( (Row.TextEntry, 36)),

        ColumnDefinitions = Columns.Define(
            (Column.Description, Star),
            (Column.Input, Stars(2))),

        Children =
        {
            new Label()
                .Text("Code:")
                .Row(Row.TextEntry).Column(Column.Description),

            new Entry
            {
                Keyboard = Keyboard.Numeric,
            }.Row(Row.TextEntry).Column(Column.Input)
             .BackgroundColor(Colors.AliceBlue)
             .FontSize(15)
             .Placeholder("Enter number")
             .TextColor(Colors.Black)
             .Height(44)
             .Margin(5, 5)
             .Bind(Entry.TextProperty, static (ViewModel vm) => vm.RegistrationCode, static (ViewModel vm, string text) => vm.RegistrationCode = text)
        }
    };
}

enum Row { TextEntry }
enum Column { Description, Input }

}

El 16 abr 2024, a las 4:31 p. m., David Barbet @.***> escribió:

Format document should respect an .editorconfig, where you can configure how formatting behaves. See https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

If something is not working, please provide an example of the original code, how it gets formatted, your editorconfig, and how you expect it to be formatted.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/vscode-csharp/issues/7050#issuecomment-2059790319, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUKHASE6KIXA5JH2L7JO3Y5V4AVAVCNFSM6AAAAABGHOMVZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZG44TAMZRHE. You are receiving this because you authored the thread.

dibarbet commented 4 months ago

I'm not able to reproduce any issues with the above code in a Maui app. Running 'Format Document' does not make any formatting changes to the sample code, which is what I would expect.

Would you mind sharing a before / after screenshot? Or are you expecting that format document does something else, and if so what behavior are you expecting?

dibarbet commented 1 week ago

Closing, not actionable without the requested information. If you're able to provide it, please re-open the issue with the additional information.