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

Razor editor messes up indention of collection initializers when formatting the document #11491

Open
MarvinKlein1508 opened this issue Feb 14, 2025 · 4 comments

Comments

@MarvinKlein1508
Copy link

When using collection initializers the formatting will be messed up everytime you format the document using CTRL+K,D

Please see this small video for details:
https://github.com/user-attachments/assets/6bbd5fff-7f39-4118-9f35-6a160317783a

@davidwengier
Copy link
Member

davidwengier commented Feb 14, 2025

I recently rewrote the Razor formatter, and one of the benefits of the new one is that this problem should be solved. If you're using VS 17.14 preview then you should already have the new formatting engine, so would be good to confirm.

@MarvinKlein1508
Copy link
Author

Hi @davidwengier indeed I have VS Preview as well. Looks like the endless indention has been fixed here. However there are still some formatting issues here. The semicolon will trigger the first one to move a tab and all items within will also move one indention. Please see this video:

2025-02-14.10-14-52.mp4

@davidwengier
Copy link
Member

davidwengier commented Feb 14, 2025

Glad to hear it! The semi colon thing is #11488 and that bit happens to still use the old formatter, but that's not why it's broken, just an odd coincidence.

@davidwengier
Copy link
Member

Actually, now that I have a slightly bigger screen to watch on, I think the moving of the initial square bracket is probably not fixed by #11488 but will be fixed when on type formatting gets moved to the new formatter. Will leave this issue open to track that I think

@MarvinKlein1508 MarvinKlein1508 changed the title Razor editos messes up indention of collection initializers when formatting the document Razor editor messes up indention of collection initializers when formatting the document Feb 17, 2025
@phil-allen-msft phil-allen-msft modified the milestones: Backlog, 2025-Q1 Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants