In the last two weeks I have used this Prettier plugin to work on Hugo templates:
This one has a good performance.
I propose it for evaluation and, perhaps, we can add it to the Hugo documentation
The importance of this topic had been pointed out here: notes: Installing code formatter in VS Code · Issue #1480 · gohugoio/hugoDocs · GitHub.
In the same link, some detailed instructions for installation are mentioned.
Thanks to @niklaspor for his work to improve this plugin.