Vetur: js-beautify-html 格式化错位

Created on 26 Sep 2018  ·  6Comments  ·  Source: vuejs/vetur

  • [ ] I have searched through existing issues
  • [ ] I have read through docs
  • [ ] I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.12.7 | 2018-09-24
  • VS Code version: 1.27.2

Problem



今天我更新了vetur
然后使用 js-beautify-html后,格式化得到的结果
image

template标签里面的格式化错位了
当代码行数多了,错位更严重,影响开发

Reproducible Case

question upstream

Most helpful comment

我也发现了这个问题。
今天更新到Vetur version: 0.12.7,
只要是input、img等无需闭合的标签,都会格式化错位。希望解决!

All 6 comments

我也发现了这个问题。
今天更新到Vetur version: 0.12.7,
只要是input、img等无需闭合的标签,都会格式化错位。希望解决!

https://vuejs.github.io/vetur/formatting.html#js-beautify-html-deprecated

Alternative html formatter. Deprecated, turned off by default and will be removed soon. js-beautify is not actively maintained and has many long-standing bugs. Use at your own risk.

You should open issues for js-beautify. Thanks.

I got the same issue. I wonder if js-beautify-html is deprecated, what can i use

@shangxinbo I'm working on https://github.com/vuejs/vetur/pull/912.

Actually for people in this thread, see https://github.com/vuejs/vetur/issues/921#issuecomment-426710032

You can set the below setting until the upcoming release, when I'll make it the default setting.

    "vetur.format.defaultFormatterOptions": {
      "js-beautify-html": {
        "unformatted": []
      }
    }

@octref Thanks!This has bothered me for a long time.

Was this page helpful?
0 / 5 - 0 ratings