Suggest learn how to apply user settings in your text editor environment to best emulate what you see here. In other words, don’t waste your time. Learn the language, not the formatting. Syntax highlighting is a convenience, not something we should really lean on. If you really want to learn a language, code with syntax highlighting turned off and study the error messages. It wasn’t that long ago we were still using monochrome monitors.
Maybe you can try vscode extension “Prettier”. It can automatically formatting when pressing ctrl-s.