prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.15k stars 456 forks source link

support for django-template #1705

Closed mh-firouzjah closed 3 years ago

mh-firouzjah commented 3 years ago

hi there, the need for a code formatting extension on vscode for Django-templates is reported a lot, but still there is nothing available yet. I have something working when we are typing the code, but it's not working for on-save/paste, and maybe it would if you help and add something like that to your extension. these rules are tested with the 'Django' extension written by Baptiste Darthenay, and work fine. I'm asking if these could be improved and available in Perrtier-vscode. thanks for attention.

"indentationRules": {
    "increaseIndentPattern": "((\\<)(body|address|blockquote|dd|div|dl|dt|tr|tbody|thead|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|a|menu|pre|table|button|a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var))|(\\{\\%)\\s*(autoescape|block|blocktrans|blocktranslate|plural|comment|debug|for|empty|if|elif|else|ifchanged|ifequal|ifnotequal|from|spaceless|with|verbatim|thumbnail)",
    "decreaseIndentPattern": "((\\<\\/)(.*)*(\\>))|((\\{\\%)\\s*(empty|elif|else|end(autoescape|block|blocktrans|blocktranslate|comment|for|if|ifchanged|ifequal|ifnotequal|spaceless|with|verbatim|thumbnail)))"
  }
ntotten commented 3 years ago

This extension just runs prettier. It supports prettier plugins so if there is a plug-in for this it would work. If not, somebody needs to write a plugin. https://prettier.io/docs/en/plugins.html

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.