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.

vs code, code formatting is not working.

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.11.5
  • VS Code version: 1.19.1

Problem

I uninstalled all the extensions and reinstalled vetur several times, vue code formatter still doesn’t work.

image

{
    "window.openFilesInNewWindow": "off",
    "explorer.confirmDelete": false,
    "[vue]": {
        "editor.formatOnSave": true,
                
    },
    "files.associations": {
        "*.vue": "vue"
    }
}

Reproducible Case

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

48reactions
lzl124631xcommented, Feb 4, 2018

I added the following setting to .vscode/settings.json.

{
    "vetur.format.defaultFormatter.html": "js-beautify-html"
}

The formattingOnSave for HTML does work.

  • Why is the default html formatter disabled?
  • Can you add “where to add those json config”? You only listed those json but didn’t say where to put it.

update: How to edit .vscode/settings.json?

ctrl + shift + p > Configure Language Specific Settings > Vue > Edit the file.

My current settings:

{
    "window.openFilesInNewWindow": "off",
    "explorer.confirmDelete": false,
    "[vue]": {
        "editor.formatOnSave": true,
                        
    },
    "files.associations": {
        "*.vue": "vue"
    },
    "vetur.format.defaultFormatter.html": "js-beautify-html"
}
16reactions
arturmaizcommented, Jun 17, 2018

Try go to vetur configuration, and change => “vetur.format.defaultFormatter.html”: “js-beautify-html”

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Prettier - Code formatter" is not working in Visual Studio code
"Prettier - Code formatter" is not working in Visual Studio code · which os are you using · or you can press Ctrl+shift+p...
Read more >
Format on Save (prettier) stopped working with latest update
File -> Preferences -> Settings (for Windows) Code -> Preferences -> Settings (for Mac) Search for "Default Formatter". In the dropdown, ...
Read more >
Why my VS code pettier not working ? : r/vscode - Reddit
Why my VS code pettier not working ? · 1.Command + Shift + p · 2.type format document with · 3.select Configure Default...
Read more >
Prettier not working in VSCode – possible fixes - LinuxPip
Set Prettier as Default Formatter · Set Prettier as preferred formatter · Disable and re-enable Prettier extension · Recent Posts.
Read more >
How To Auto-Format Code in VS Code - Alphr
1. Open Visual Studio Code on your computer. 2. Navigate to the extension tab on the left side of the screen. It’s represented...
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