Vetur: Extension 'Vetur' cannot format 'test.vue'

Created on 24 Jun 2020  路  7Comments  路  Source: vuejs/vetur

Info

  • Platform: macOS
  • Vetur version: 0.24.0
  • VS Code version: 1.47.0-insider

Problem

After setting Vetur as the default formatter for Vue files I get a generic error when trying to format a vue component:
Extension 'Vetur' cannot format 'test.vue'

2020-06-24 09 07 20

Reproducible Case

Install Vetur and set it as the default formatter. Create a new Vue component:

<template lang="pug">
div
  div.my-class Test
</template>

Then right click and click 'Format Document'.

need-more-info

Most helpful comment

In any project quasar have a some problem

All 7 comments

Output -> Vue Language Server, any output?

In any project quasar have a some problem

In any project quasar have a some problem

I removed the prettier from vscode and it worked.
I had to use eslint formatting

No follow-up from OP -> closing.

same issue here, no output in Vue Language Server

see GIF:

2020-09-01 16 22 28

This is in my project in the root folder at .vscode/settings.json

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
  "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
  "[vue]": { "editor.defaultFormatter": "octref.vetur" },
  "[sass]": { "editor.defaultFormatter": "syler.sass-indented" },
  // make sure vetur is enabled
  "eslint.validate": ["javascript", "javascriptreact", "typescript", "vue"],
  "vetur.experimental.templateInterpolationService": false,
  "vetur.format.enable": false,
  "vetur.validation.style": true,
  "vetur.validation.template": true,
  "vetur.validation.script": true,
  // disable conflicting formatting
  "javascript.validate.enable": false,
  "typescript.format.enable": false,
  "standard.enable": false,
  // global important defaults
  "editor.tabSize": 2, // make sure this is the same as .prettierrc
  "files.trimFinalNewlines": true,
  "files.trimTrailingWhitespace": true,
  "editor.insertSpaces": true,
  // script
  "vetur.format.defaultFormatter.ts": "prettier",
  "vetur.format.defaultFormatter.js": "prettier",
  // stylus
  "vetur.format.defaultFormatter.stylus": "stylus-supremacy",
  "stylusSupremacy.insertColons": true,
  "stylusSupremacy.insertBraces": false,
  "stylusSupremacy.insertSemicolons": false,
  "languageStylus.useSeparator": true,
  // sass
  "vetur.format.defaultFormatter.sass": "sass-formatter",
  "sass.format.debug": false,
  "sass.format.deleteEmptyRows": true,
  "sass.format.deleteWhitespace": true,
  "sass.format.convert": true,
  "sass.format.setPropertySpace": true,
  // typescript
  "typescript.tsdk": "node_modules/typescript/lib",
  "eslint.enable": true
}

@mesqueeb Please open new issue with a reproducible case: https://github.com/vuejs/vetur/blob/master/.github/NO_REPRO_CASE.md

I cannot get the source of the file you are formatting by just looking at a gif.

What worked for me was changing:
"vetur.format.enable": false
to
"vetur.format.enable": true

I think quasar might disable this by default when creating through the cli

Was this page helpful?
0 / 5 - 0 ratings