-
-
Notifications
You must be signed in to change notification settings - Fork 442
how to disabled volar template format #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, Please refer to this page to change the formatter.
|
How do you trigger document formatting? If trigger formatting on save, just disable VSCode theoretically will not use two formatters at the same time, unless ESLint does not work through the Formatting API. |
my settings {
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.formatOnSave": false,
"[vue]": {
"editor.formatOnType": true,
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
} oh, tks |
Essentially the problem is that ESLint format conflicts with VSCode format, and volar can't handle. |
Hey there, Here are some of the settings I've played around with. Any idea how to get Prettier running? // VS Code settings
{
"volar.tsPlugin": true,
"volar.icon.preview": true,
"volar.icon.finder": true,
"eslint.format.enable": false,
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.formatOnType": false,
"editor.formatOnSave": false
},
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.fixAll.eslint": false
},
"eslint.workingDirectories": ["./frontend"],
"prettier.enableDebugLogs": true,
"prettier.useEditorConfig": false,
"prettier.enable": true,
"eslint.format.enable": false,
"prettier.enable": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
} // .eslintrc.js
module.exports = {
root: true,
env: {
// https://eslint.org/docs/rules/no-undef#nodejs
// browser: true,
// es2021: true,
node: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module',
ecmaVersion: 2021,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'plugin:prettier/recommended',
],
plugins: ['vue', '@typescript-eslint'],
settings: {
'import/resolver': {
alias: {
extensions: ['.vue', '.ts', '.tsx', '.js', '.jsx'],
map: [['@/', '.src/']],
},
},
},
rules: {
// The core 'no-unused-vars' rules (in the eslint:recommended rule set)
// does not work with type definitions
'no-unused-vars': 'off',
// not needed for vue 3
'vue/no-multiple-template-root': 'off',
},
} I have also installed the Pretier-ESlint extension hopeing that I can somehow override everything else but it's just now working -.- Prettier is working as expected if I manually format via Help highly appreciated :) |
@2malh have you try |
Yes, absolutely. As you can see above I have |
@2malh not sure I understand your needs, do you want to use Prettier automatic formatting when saving vue documents? If yes you just need to set this: {
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
} |
I'd love it to be that easy. Activating the formatting like this unfortunately reintroduces the same glitch as you can see in the gif from OP :( So there must be somethting else (ESlint? Volar?) doing it's formatting job too. I'm pretty sure the problem is on my side having something set wrong but so far I haven't found what it is. |
@2malh the gif problem is ESLint format and VSCode format working at the same time, I don't use ESLint so I can't help, please google "How to disable eslint formatting". |
@2malh It sounds like the problem is that you did not succeed in setting ESLint or Prettier as the default formatter. I can try to check your setting, please @ me in Discord. |
Just in case someone else might have this problem in the future: It was the Headwinds extension that collisions with Prettier ^2.3.0 Relevant issues: Prettier/eslint worked fine but headwinds reformattet everything into a single line. |
By disabling VSCode built-in formatter |
It should do(implement at https://github.com/volarjs/plugins/blob/a734f87f0ae8903c00e3ff2c4db3350cc2ca1e75/packages/html/src/index.ts#L128-L130), please open a bug report if not works. |
now, I use eslint-plugin-vue and rule

vue/max-attributes-per-line
vue/singleline-html-element-content-newline
when use format, I can see eslint-plugin-vue change code For a moment volar change again , As shown
So, how to disabled volar template format? only use eslint fix format.
tks
The text was updated successfully, but these errors were encountered: