vscode beautify code formatting django-template

498 views Asked by At
"html.format.templating": false,

there is this setting in the docs, related to vscode. which has a definition but it's not clear enough we have to set this to true or flase? and even worth, it doesn't matter which statement is set. the beautify doesn't care. it will always format the (django-tamplate) tags.

<ul class="navbar-nav nav-flex-icons {% if LANGUAGE_BIDI %} mr-auto {% endif %}">
    {% get_available_languages as languages %}
    {% for lang_code, lang_name in languages %}
    {% if lang_code != LANGUAGE_CODE %}
    {% language lang_code %}
    <li class="nav-item">
      <a class="nav-link lang-setter" data-lang-code="{{ lang_code }}">
        {{ lang_code|language_name_local }}
      </a>
    </li>
    {% endlanguage %}
    {% endif %}
    {% endfor %}
</ul>

this is the result. I also provided the indention rule needed, but I couldn't find a way to force this rule for vscode code formatters like beautify or prettier.

  "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|comment|for|empty|if|elif|else|ifchanged|ifequal|ifnotequal|from|low|regroup|ssi|spaceless|templatetag|widthratio|with|verbatim|thumbnail)",
      "decreaseIndentPattern": "((\\<\\/)(.*)*(\\>))|((\\{\\%)\\s*(empty|elif|else|end(autoescape|block|blocktrans|blocktranslate|comment|for|if|ifchanged|ifequal|ifnotequal|spaceless|with|verbatim|thumbnail)))"
      }
0

There are 0 answers