Js-beautify: `force-expand-multiline` doesn't work as expected

Created on 8 May 2017  路  17Comments  路  Source: beautify-web/js-beautify

Description

force-expand-multiline doesn't work as expected.

Input

The code looked like this before beautification:

<template>
  <div
    class="test"
    @click="test"
  >
    <input
      ref="test"
      v-if="test"
    >
      <div>
        <span>test</span>
      </div>
      </div>
</template>

Expected Output

The code should have looked like this after beautification:

<template>
  <div
    class="test"
    @click="test"
  >
    <input
      ref="test"
      v-if="test"
    >
    <div>
      <span>test</span>
    </div>
  </div>
</template>

Actual Output

The code actually looked like this after beautification:

> html-beautify --version
1.6.12
> html-beautify -f test.html -A "force-expand-multiline"
<template>
  <div
    class="test"
    @click="test"
  >
    <input
      ref="test"
      v-if="test"
    >
      <div>
        <span>test</span>
      </div>
      </div>
</template>%

Steps to Reproduce

Environment

OS: macOS 10.12.4

Settings

> html-beautify -f test.html -A "force-expand-multiline"

Related https://github.com/octref/vetur/issues/99

html bug

Most helpful comment

fixed in 1.7.6

All 17 comments

+1

@octref - your input is missing a closing /:

 <input
      ref="test"
      v-if="test"
    >

I assume that is just a typo during bug filing.

I thought for self closing tags / is optional.
But even if I add / this still happens.

@octref
You're probably right. I don't know off the top of my head. I mention it only because the input text was different from output (in a non-formatting way).

@bitwiseman Right, I fixed that. Sorry for the confusion.

What's the status on this one? I'd really love to see this fixed.

@msmolcic - This issue is unassigned. It needs someone to take the time to implement a fix and tests.

People still getting this issue?
I seem to be getting it with "html.format.wrapAttributes": "force-expand-multiline" on [email protected]

@GearoidCollins
it still not working on [email protected]

it still not working on [email protected] too

@Predve4niy
This issue is unassigned. It needs someone to take the time to implement a fix and tests.

"vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
        "wrap_attributes": "force-expand-multiline",
    },
}

Still doesn't work as expected.

+1

+1

@bitwiseman have you fixed it ?

@EzioW
This issue is unassigned. It needs someone to take the time to implement a fix and tests.

fixed in 1.7.6

Was this page helpful?
0 / 5 - 0 ratings