将格式化程序(美化器)添加到Visual Studio Code中的django-html文件中 [英] Add a formatter (beautifier) to django-html files in Visual Studio Code
问题描述
我正在使用Django扩展程序在Jinja模板(VS Code)上进行智能感知和语法突出显示,但无法弄清楚如何使用默认格式化程序(HookyQR Beautify)美化/格式化django-html文件. 有可能吗?
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. Would that be possible?
推荐答案
我只需要对django-html
文件使用美化功能,我对js,html,css和flake8和autopep8适用于python,对于django-html
更漂亮的错误地格式化了Jinja模板字符串,
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,
所以我禁用了Pettier语言的django-html
,并使用了从
so I disabled the django-html
from pettier languages and used these settings got from this issue discussion., works for me well.
{
"prettier.disableLanguages": ["django-html"],
"beautify.language": {
"html": [
"django-html"
]
},
"[django-html]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "HookyQR.beautify"
}
}
这篇关于将格式化程序(美化器)添加到Visual Studio Code中的django-html文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!