Visual Studio代码删除了如意换行符和缩进

时间:2016-10-28 14:40:14

标签: visual-studio-code indentation line-breaks

以下是带有一些Django模板标记的HTML代码示例:

{% extends "blog/base.html" %}
{% block title %}
    Title
{% endblock %}
{% block content %}
    <h1>Header</h1>
    {% for post in posts %}
        <h2>
            <a href="{{ post.get_absolute_url }}">
                {{ post.title }}
            </a>
        </h2>
        <p class="date">
            Published {{ post.publish }} by {{ post.author }}
        </p>
        {{ post.body }}
    {% endfor %}
    {% include "pagination.html" with page=posts %}
{% endblock %}

我希望它看起来像这样。但VS Code将其重新格式化为此视图:

{% extends "blog/base.html" %} {% block title %} Title {% endblock %} {% block content %}
<h1>Header</h1>
{% for post in posts %}
<h2>
    <a href="{{ post.get_absolute_url }}">
                {{ post.title }}
            </a>
</h2>
<p class="date">
    Published {{ post.publish }} by {{ post.author }}
</p>
{{ post.body }} {% endfor %} {% include "pagination.html" with page=posts %} {% endblock %}

我该怎么做才能防止这种丑陋的重新格式化?

0 个答案:

没有答案