Razor formatting isn't respecting indents on save in VS Code
I have a snippet of Razor within an @if block, and when running VS Code Format Document everything except the first line of the Razor code is collapsed back to a zero-depth indent.
File in question can be found here.
Environment details:
Version: 1.88.0-insider (user setup)
Commit: b0d975fc6370f15570c380f41015b1ca2cdcb791
Date: 2024-03-25T05:49:32.344Z
Electron: 28.2.6
ElectronBuildId: 27476517
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631
C# extension - v2.22.5 C# DevKit - v1.4.29
$ dotnet --list-sdks
8.0.202 [/usr/share/dotnet/sdk]
OS - Linux (via devcontainer)
Doesn't repro in VS
Doesn't repro for me in VS Code either, but formatting the document inserts a newline after the @if before the { 🤦♂️
I'm able to repo still (even after VS Code and machine restarts). Is there any logs that I can provide that might give insights?
You could try setting the Razor log level to "Trace" and then formatting, and include the Razor Log from the output. Not sure if it will be super useful though. I suspect whatever is doing your HTML formatting in VS Code (could be an extension, could be built-in but there are various options) is giving us back something we don't necessarily handle, but I don't know if that detail will be in the logs, nor if it will be anything we can really use.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
Please see our Issue Management Policies for more information.