Skip to content

Razor formatting configuration in VS Code (macOS) #11914

@Tabonx

Description

@Tabonx

Hello,

I’ve started working on a Blazor Hybrid project and am encountering inconsistent formatting in .razor files. I’m the only one on macOS using VS Code, while the rest of my team uses Visual Studio on Windows. I’d like to match their formatting style, but I can’t figure out how to configure it.

Problem

Here's an example:

Expected formatting:

<div class="some-class">
    <Something Data="@Values"
               ValueField="Value"
               TextField="Label"
               Value="@SelectedValue"
               ValueChanged="@((int value) => OnValueChanged(value))"
               ValueExpression="@(() => SelectedValue)"
    />
</div>

Actual formatting (VS Code on macOS):

<div class="some-class">
    <Something Data="@Values" ValueField="Value" TextField="Label" Value="@SelectedValue"
               ValueChanged="@((int value) => OnValueChanged(value))" ValueExpression="@(() => SelectedValue)"
    />
</div>

My Setup

  • macOS
  • Visual Studio Code
  • Installed extensions:
    • C# Dev Kit (pre-release)
    • .NET MAUI

Questions

  • Is Razor formatting in VS Code configurable to match the style of my colleagues?
  • Is there a config file or setting I’m missing?
  • Is this a limitation or a bug in the Razor Language Server for VS Code?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions