Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect HTML formatting with "html.format.indentHandlebars": false #1127

Open
aeschli opened this issue Feb 7, 2017 · 5 comments
Open

Comments

@aeschli
Copy link

aeschli commented Feb 7, 2017

Here is an extract of HTML (Angular 2) code:

  <app-root>Loading...</app-root>
{{#each scripts.polyfills}}
  <script src="{{.}}"></script>
{{/each}}

After format with"indentHandlebars": false :

  <app-root>Loading...</app-root>
  {{#each scripts.polyfills}}
  <script src="{{.}}"></script> {{/each}}  

instead of :

  <app-root>Loading...</app-root>
{{#each scripts.polyfills}}
  <script src="{{.}}"></script>
{{/each}}

I expect unchanged Angular/handlebar indentation with "indentHandlebars": false

Copied from original issue: microsoft/vscode#8144

@HookyQR
Copy link
Contributor

HookyQR commented Feb 10, 2017

Has the same cause as #1103.

@bitwiseman
Copy link
Member

@aeschli could you show a bit more of your example?
The current output for the input you provided is:

<p>
    <app-root>Loading...</app-root>
    {{#each scripts.polyfills}}
    <script src="{{.}}"></script>
    {{/each}}
</p>

Is that sufficient?

@aeschli
Copy link
Author

aeschli commented Feb 16, 2017

@pierredewilde Can you help @bitwiseman ?

@pierredewilde
Copy link

Yep, the example is sufficient to show the correct output.

Before the fix, the output was

  <app-root>Loading...</app-root>
  {{#each scripts.polyfills}}
  <script src="{{.}}"></script> {{/each}}  

After the fix, the output is

  <app-root>Loading...</app-root>
  {{#each scripts.polyfills}}
  <script src="{{.}}"></script>
  {{/each}}

Ideally, in Visual Studio Code with "html.format.indentHandlebars": false, the output should be untouched

  <app-root>Loading...</app-root>
{{#each scripts.polyfills}}
  <script src="{{.}}"></script>
{{/each}}

but the current fix is OK.

@bitwiseman
Copy link
Member

This would now be an enhancement. If we do not indent handlebars, they are treated as content, and then get indented like content. I see how the name could be confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants