问题:当我自动意向时,它会删除模板中的所有缩进标记/python逻辑。
是否有一个插件可以为Django模板提供自动缩进?如果没有,如何编辑Auto-indent Lines命令⌃⌥I以支持以下所述的格式设置:
index.html:
{% block title %}
{# note the indent here with django logic #}
{% render title_tag with title="Sign up Now" global=global %}
{% endblock %}
{% block description %}
{# note the indent here with html markup #}
<meta name="description" content="Sign up today with our product.">
{% endblock %}
{% block body %}
{# note the indent here If statement #}
{% if true %}
<section class="section">
<p> here too</p>
</section>
{% if false %}
<div>
<p>wowo</p>
</div>
{% endif %}
{% endif %}发布于 2016-04-19 08:20:59
答案:
为了或多或少地格式化这些东西(例如,保持块内的缩进),IDE必须理解Django标记。网络-7814票正在问这个问题(星空/投票/评论),以得到任何进展的通知。
现在,我可能只建议安装"Twig Support“插件(应该与WebStorm一起工作)。Twig使用非常类似的语法(受Django启发),因此在这里应该会有所帮助。否则
小枝插件:插件+格式化+用法安装指南








https://stackoverflow.com/questions/36699340
复制相似问题