Prettier option vue-indent-script-and-style is not used
See original GitHub issueInfo
- 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:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top 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 JsPrettier 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
andvetur.format.scriptInitialIndent
This seemed to work for me in indenting script styling.
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” },