Skip to content

force-expand-multiline not working correctly with handlebars block statements #1537

@brokenalarms

Description

@brokenalarms

Description

This is getting really close to a perfect working formatter of hbs files in VSCode... just still one more issue. There doesn't seem to be any way to -not- get the formatting to inline the first attribute for handlebars block statements. So these stay the same and all the HTML elements do have their attributes put as multiline.

Input

The code looked like this before beautification:

{{#hbs-block my-attribute="1"
  my-second-attribute="2"
}}
<div my-attribute="1"
  my-second-attribute="2"></div>

Expected Output

The code should have looked like this after beautification:

{{#hbs-block
  my-attribute="1"
  my-second-attribute="2"
}}
  <div
    my-attribute="1"
    my-second-attribute="2"
  >
  </div>

Actual Output

The code actually looked like this after beautification:

{{#hbs-block my-attribute="1"
  my-second-attribute="2"
}}
  <div
    my-attribute="1"
    my-second-attribute="2"
  >
  </div>

Steps to Reproduce

Environment

OS:

Settings

{
    "html.format.enable": true,
    "html.format.maxPreserveNewLines": 1,
    "html.format.preserveNewLines": true,
    "html.autoClosingTags": true,
    "html.format.extraLiners": "head, body, /html, t-def",
    "html.format.unformatted": "wbr,t-def",
    "html.format.wrapAttributes": "force-multiline",
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions