无论我做什么,Visual Studio Code格式都可以保存.如何停止呢? [英] Visual Studio Code formats on save no matter what I do. How do I stop this?
问题描述
我正在html文件中使用python(Django语法):
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>
无论我在VS Code settings.json(针对用户OR工作区)中做什么,它都将格式化代码,如下所示:
No matter what I do in the VS Code settings.json (for user OR workspace) it formats the code like this:
<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>
(除其他外,将 {%for album.song_set.all%}
中的歌曲添加到上一行,并使其保持在单独的行中.
(pushes the {% for song in album.song_set.all %}
among other things to the previous line and keeps it from being on its own line.
这是我的vs代码设置:
Here are my vs code settings:
{
"editor.fontSize": 18,
"editor.formatOnType": false,
"editor.formatOnSave": false,
"editor.glyphMargin": true,
"editor.tabSize": 4,
"editor.detectIndentation": false,
"editor.wordWrap": true
}
这些设置对于用户和工作空间都是相同的.我想念什么吗?
These settings are the same for both user and workspace. Am I missing something?
谢谢,扎克
推荐答案
Turns out the JS-CSS-HTML Formatter extension for VS Code was formatting it that way and I had to disable it.
扎克
这篇关于无论我做什么,Visual Studio Code格式都可以保存.如何停止呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!