I've got some legacy code I'm trying to edit in Visual Studio Code. It's a mix of HTML and C# EG:
<section id="mod-minisearch">
<!--#includefile="assets/includes/mini-search.aspx"-->
<% Server.Execute("/something/code.aspx")
</section>
It's a bit like Razor, but not the same. I've tried a number of Formatters C#, Razor, HTML etc. All destroy the code in one way or another.
If I format it in Visual Studio (2019) it's great. Is there a way I can use Visual Studio's formatter in Visual Studio Code?
I know the simple answer would be, "use Visual Studio instead of Code", but there are a number of reason for using Visual Studio Code over Visual Studio.
Thanks.
Update: I've now setup my default formatter to be Prettier - Code formatter
This works fine if I right click and select Format Document, but when I save it insists in putting spaces in places like this
Before save
Server.Execute("/Modules/
After save
Server.Execute(" /Modules/
Which can break the code. I've disabled format on save for the moment. But can anybody think why this would happen. This is my setup Json.
"editor.defaultFormatter": "mblode.pretty-formatter",
"[HTML]": {
"editor.defaultFormatter": "mblode.pretty-formatter",
"editor.formatOnSave": false
}