[英]Add a formatter (beautifier) to django-html files in Visual Studio Code
I'm using the Django extension for intellisense and syntax highlighting on Jinja templates (VS Code) but cannot figure out how to use my default formatter (HookyQR Beautify) to beautify/format my django-html files.我正在使用 Django 扩展来在 Jinja 模板(VS Code)上进行智能感知和语法突出显示,但无法弄清楚如何使用我的默认格式化程序(HookyQR Beautify)来美化/格式化我的 django-html 文件。 Would that be possible?
那可能吗?
I need to use beautify only for django-html
files, I've got prettier working for js, html, css then flake8 and autopep8 for python, for django-html
prettier wrongly formats jinja template strings, I need to use beautify only for
django-html
files, I've got prettier working for js, html, css then flake8 and autopep8 for python, for django-html
prettier wrongly formats jinja template strings,
so I disabled the django-html
from pettier languages and used these settings got from this issue discussion.所以我从小语言中禁用了
django-html
,并使用了从这个问题讨论中获得的这些设置。 , works for me well. ,对我很有效。
{
"prettier.disableLanguages": ["django-html"],
"beautify.language": {
"html": [
"django-html"
]
},
"[django-html]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "HookyQR.beautify"
}
}
This seems to have sorted it for me, allowing me to keep HookyQR Beautify for normal HTML files and have a separate one for django-html files:这似乎已经为我排序,允许我为普通的 HTML 文件保留 HookyQR Beautify,并为 django-html 文件保留一个单独的文件:
"beautify.language": {
"html": [
"django-html"
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.