Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object initializer block indented one more level that in plain .cs file #7933

Closed
vsfeedback opened this issue Nov 18, 2022 · 6 comments · Fixed by #11364
Closed

Object initializer block indented one more level that in plain .cs file #7933

vsfeedback opened this issue Nov 18, 2022 · 6 comments · Fixed by #11364
Assignees
Labels
author: migration bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author feature-formatting

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


There is very often wrong automatic indentation in C# code in razor files. If I open up an initializer like so :

AFunction(new Something()
{
    Wow = "amazing"
});

It very often ends up that way :

AFunction(new Something()
    {
        Wow = "amazing"
    });

This only happens in razor files.


Original Comments

Feedback Bot on 14/11/2022, 06:02 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@ghost ghost added untriaged author: migration bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author labels Nov 18, 2022
@davidwengier davidwengier changed the title Razor file wrong indentation Object initializer block indented one more level that in plain .cs file Nov 18, 2022
@davidwengier
Copy link
Member

Note: The formatting issue here is a difference between Roslyn and Razor, but it is worth noting it is stable, unlike previous issues in this area, where repeated formats would cause constant changes.

@phil-allen-msft phil-allen-msft added this to the Backlog milestone Dec 1, 2022
@KieranDevvs
Copy link

This is a massive pain for me as I use automatic formatting when typing. I have to disable it but it then means I cant use the feature within other language files eg .cs

@DM-98
Copy link

DM-98 commented Nov 24, 2023

It's been over a year. Shouldn't it be easy to fix this issue?

@davidwengier
Copy link
Member

If it was easy, I would have fixed it, I promise!

@KieranDevvs
Copy link

@davidwengier Thanks for the update on this, will this be available to try out in the next VS preview and is there a release timeframe on it?

@davidwengier
Copy link
Member

@KieranDevvs It will be available in the first preview after 17.13 is fully released. Sorry, I can't share dates.

It's currently behind a feature flag, but we're working on getting it enabled for everyone, so it will be opt-out, as we're pretty confident there won't be regressions, but sadly the Razor usage in VS Preview versions is pretty low.

@davidwengier davidwengier modified the milestones: Backlog, 2025-01 January Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author: migration bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author feature-formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants