Vetur: problem format code "shift + alt + f"!

Created on 21 Oct 2017  路  6Comments  路  Source: vuejs/vetur

Excuse me, how to format .vue file (Mac).
I try press shift + alt + f, but don't work on <template> and convert siglequote to dublequote on <script>

<template>
    <div>
        <h2>Message</h2>
<el-button icon="el-icon-edit" @click="message">Message</el-button>

        <h2>Notification</h2>
<el-button plain @click="notification">Success</el-button>
    </div>
</template>

<script>
export default {
  name: "Home", // default 'Home'
  data() {
    return {};
  },

All 6 comments

Thanks for your reply, but I am not clear on Doc.
Could you example?

"js-beautify-html: html (deprecated and turned off by default)"

For "Template" you have to activate on the User settings, and for the single quotes, you can install the prettier extension and change the prettier default setting

Thanks for your helping.
Now it work for single quotes

// Setting
"prettier.singleQuote": true

But still problem with indent tab and template format

<template>
    <div>
        <h2>Icon</h2>
    <i class="el-icon-edit"></i>
        <i class="el-icon-share"></i>
    <h2>Message</h2>
</template>
脧
<script>
export default {
    name: 'Home', // 1 tap by default
  data() { // after format
    return {};
  },

Mine is fixed.

  1. Install Prettier extension.
    URL - https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
  2. Go to File > Preferences > Settings
  3. Add below,
    "prettier.singleQuote": true,
    "prettier.semi": false,
    "prettier.eslintIntegration": true
  4. Save.
  5. Try Alt + Shift + F

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yoyoys picture yoyoys  路  3Comments

AnnAngela picture AnnAngela  路  3Comments

deangoku picture deangoku  路  3Comments

sacki5 picture sacki5  路  3Comments

gabrielboliveira picture gabrielboliveira  路  3Comments