Django template file support for vscode
About
this extention inherit from https://github.com/vscode-django/vscode-django, thanks.
Features
- syntax highlight;
- html, css, javascript syntax highlight;
- format and pretty code;
- auto completion for html tags, attributes, css, javascript;
- some error/problem tips when formatting;
- formatted by prettier, can automatic search prettier config file in the dirs, such as .prettierrc, .prettier.json...;
Default file associated to django template support
.django
.dj
Add your file associations to django template support
"files.associations": {
"**/views/**/*.html": "django-html",
"*.tpl": "django-html"
},
- shortcut:
shift+alt+f
- context menu:
Format Document
- set formatting on saving files:
"[django-html]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "junstyle.vscode-django-support"
},
How to ignore code, use prettier-ignore and prettier-ignore-start
When you are not happy with how Prettier formats a certain element or section in the code, you can tell it to leave it in peace:
{# prettier-ignore #}
<div class="weird-formatting" >This will not be re-formatted</div>
<div class="weird-formatting" >But this will be</div>
You can also tell Prettier to leave entire regions as they are:
{# prettier-ignore-start #}
...
{# prettier-ignore-end #}
If you love this extension, you could
| |