I am trying to get the Prettier formatter in Visual Studio Code to format the code when the file is autosaved, and it does work, however, the code is formatted before I am even done typing and it makes developing more difficult because of this.

For example, if I type in an h2 tag it drags the cursor to a weird spot, when I type in color for example, Prettier will autocomplete the CSS and place my cursor to the right of the ";" so the code looks like this:

h2 {
color: ; /*(on typing "color:" the cursor is dragged here outside of the colon so I have to click back inside of it to type a color)*/
}

How can I have the document autosave itself so I don't potentially lose my work, but also have the formatter kick in shortly after to format the code when I am finished typing? I don't want to have to manually save the document or manually format it. Is this achievable? I am using the VS Code autosave setting.

0

There are 0 best solutions below