question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prettier option vue-indent-script-and-style is not used

See original GitHub issue

Info

  • Platform: macOS Mojave 10.14.5
  • Vetur version: 0.22.6
  • VS Code version: 1.40.0

Problem

I wanted to use the option vue-indent-script-and-style from prettier but this option is not recognized by vetur. I think this is because vetur is using an outdated version of prettier. The option vue-indent-script-and-style was just added recently (see: https://github.com/prettier/prettier/releases/tag/1.19.0) so I guess we just need to upgrade prettier

Reproducible Case

settings.json of VSCode:

"vetur.format.defaultFormatter.css": "none",
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "none",
"vetur.format.defaultFormatter.less": "none",
"vetur.format.defaultFormatter.postcss": "none",
"vetur.format.defaultFormatter.scss": "prettier",
"vetur.format.defaultFormatter.stylus": "none",
"vetur.format.defaultFormatter.ts": "none"

.prettierrc.js

module.exports = {
  printWidth: 200,
  'vue-indent-script-and-style': true,
}

By the way: it would be nice to have an option for indent for "vetur.format.defaultFormatter.ts": "vscode-typescript" as well because I don’t like prettier too much for my TS/JS code

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
spenwallcommented, Nov 20, 2019

From my research I found that the prettier option for vueIndentScriptAndStyle doesn’t work with vetur even using the latest prettier version. You can however use the options.

vetur.format.styleInitialIndent and vetur.format.scriptInitialIndent

This seemed to work for me in indenting script styling.

0reactions
Pilag6commented, Nov 24, 2022

Guys, I found the option to add the following code into the settings.json . I am only using Prettier, not Vetur

“[vue]”: { “editor.defaultFormatter”: “esbenp.prettier-vscode” },

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options - Prettier
Developers often use whitespace to break up long lines for readability. ... Prettier's printWidth option does not work the same way. It is...
Read more >
Why does Prettier not format code in VS Code? - Stack Overflow
For me, it was not working even after making all the configuration setting changes. Then, I realized I was trying to format a...
Read more >
JsPrettier - Package Control
The easiest and recommended way to install Js​Prettier is using Package ... mode also sets Prettier's --loglevel option to debug (when not overridden...
Read more >
Prettier is converting vue html attributes to single quotes. Only ...
It's seem the keymap of use prettier to format (options + shift + command + P)and Format Code (shift + options + F)...
Read more >
ESLint and Prettier with Vite and Vue.js 3 - Vue School Blog
Combing ESLint and Prettier make large scale Vue 3 apps clean and error ... available for use with Vue 3 for less strict...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found