mohd-akram / vscode-html-format

A Visual Studio Code extension for formatting HTML documents.

Home Page:https://marketplace.visualstudio.com/items?itemName=mohd-akram.vscode-html-format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for sub-expressions

cryarchy opened this issue · comments

This is the best vscode Handlebars formatted that I have found (and I have tried many). Thank you.

Currently, it will reformat this:

<li>
  <a {{#if (equals pageLink "/users" ) }} class="is-active" {{/if}} href="/users">
     Users
  </a>
</li>

to:

<li>
  <a {{#if (equals pageLink"/users" ) }} class="is-active" {{/if}} href="/users">
     Users
  </a>
</li>

removing the space between the pageLink variable and the "/user" literal.

The issue seems to happen with double-quoted string literals only. The following snippets work:

<li>
  <a {{#if (equals pageLink 42 ) }} class="is-active" {{/if}} href="/users">
     Users
  </a>
</li>

and:

<li>
  <a {{#if (equals pageLink anotherVariable ) }} class="is-active" {{/if}} href="/users">
     Users
  </a>
</li>

and surprisingly this too:

<li>
  <a {{#if (equals pageLink 'single-quote' ) }} class="is-active" {{/if}} href="/users">
     Users
  </a>
</li>

Sorry about that. This is fixed in v0.0.5.