Visual Studio code formats when saved no matter what I do. How to stop it?

I am using python (django syntax) inside an html file:

<form action="{% url 'home:favorite' album.id %}" method="POST"> {% csrf_token %} {% for song in album.song_set.all %} <input type="radio" id="song{{ forloop.counter }}" name="song" value="{{ song.id }}" /> <label for="song{{ forloop.counter }}"> {{ song.song_title }} {% if song.is_favorite %} ** {% endif %} </label><br> {% endfor %} <input type="submit" value="Favorite"> </form> 

No matter what I do in the VS code settings. json (for user or workspace), it formats the code as follows:

 <form action="{% url 'home:favorite' album.id %}" method="POST"> {% csrf_token %} {% for song in album.song_set.all %} <input type="radio" id="song{{ forloop.counter }}" name="song" value="{{ song.id }}" /> <label for="song{{ forloop.counter }}"> {{ song.song_title }} {% if song.is_favorite %} ** {% endif %} </label> <br> {% endfor %} <input type="submit" value="Favorite"> </form> 

(pushes {% for song in album.song_set.all %} , among other things, to the previous line and keeps it from its own line.

Here are my code settings:

 { "editor.fontSize": 18, "editor.formatOnType": false, "editor.formatOnSave": false, "editor.glyphMargin": true, "editor.tabSize": 4, "editor.detectIndentation": false, "editor.wordWrap": true } 

These options are the same for the user and the workspace. Did I miss something?

Thanks Zach

+1
source share
1 answer

It turns out that the JS-CSS-HTML Formatter extension for VS Code formats it this way, and I had to disable it.

Zach

+1
source

Source: https://habr.com/ru/post/1014890/


All Articles