Apparently there’s no way around it for the moment, this is what they have answered in another related question: Why doesn’t Visual Studio code formatting work properly for Razor markup?
Apparently there’s no way around it for the moment, this is what they have answered in another related question: Why doesn’t Visual Studio code formatting work properly for Razor markup?