language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

How to use format

Open ling7788 opened this issue 9 months ago • 2 comments

How to use formatting for Vue files? I have enabled the settings in my configuration file, but the formatting is invalid image

ling7788 avatar May 02 '24 16:05 ling7788

image nothing changed!

ling7788 avatar May 02 '24 16:05 ling7788

Same issue here. Setting Vue-Official as the formatter does not work.

cadilhac avatar May 03 '24 14:05 cadilhac

For anyone who is seeing this issue, here's the solution for me.

  1. In a vue file, click the Vue button in the bottom right corner of VSCode, and select "Configure 'vue' languange based settings..." from the pop-up window. [^1]
  2. Add "editor.defaultFormatter": "Vue.volar" in [vue].

{
    // add formatter setting for vue files
    "[vue]": {
        "editor.defaultFormatter": "Vue.volar"
    }
}

[^1]: Or directly open your settings.json somewhere to add the setting.

zjp-CN avatar Jul 30 '24 12:07 zjp-CN