Duj*_*uje 12 visual-studio-code
我正在使用 vs 代码,它具有自动格式化功能,这很棒,但是,当我编写 HTML 文件并使用 Jinja 或 DTL 时,它的格式非常糟糕。如何为此禁用格式或更改它?
我已经安装了一个名为 Prettier 的格式化扩展。
这就是我得到的:
{{ block.super }}
{% endblock styling%} {% block title %} Game {{ game.firs_player }} vs.
{{ game.second_player }} {% endblock title %} {% block content %} This is a
detial page for game {{ game.id }}
{% endblock content %}
Run Code Online (Sandbox Code Playgroud)
这就是我要的:
{% load staticfiles %}
{% block styling%}
{{ block.super }}
{% endblock styling%}
{% block title %}
Game {{ game.firs_player }} vs.{{ game.second_player }}
{% endblock title %}
{% block content %}
This is a detial page for game {{ game.id }}
{% endblock content %}```
Run Code Online (Sandbox Code Playgroud)
你可以使用美化。它并不完美,但它完成了工作。
安装后,将其添加到您的settings.json
文件中:
"beautify.language": {
"js": {
"type": [
"javascript"
],
"filename": [
".jshintrc",
".jsbeautifyrc"
]
// "ext": ["js", "json"]
// ^^ to set extensions to be beautified using the javascript beautifier
},
"css": [
"css",
"scss"
],
"html": [
"htm",
"html",
"django-html"
]
// ^^ providing just an array sets the VS Code file type
},
Run Code Online (Sandbox Code Playgroud)
现在,它应该可以使用 Django 模板文件。
归档时间: |
|
查看次数: |
1697 次 |
最近记录: |