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.

formatOnSave is not working

See original GitHub issue

After upgrade version to v1.0.0, the vscode setting formatOnSave is not working on my machine. But when I changeprettier.eslintIntegration to true, the auto-format is working.

Are there some changes not listed on the Changelog between the version bumping? Or maybe I missed something on the vscode setting?

My Prettier - Code formatter: version 1.0.0 My vscode version: 1.18.1 My vscode setting:

"editor.formatOnSave": true,
"prettier.singleQuote": true,
"prettier.trailingComma": "es5",

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:41
  • Comments:35 (8 by maintainers)

github_iconTop GitHub Comments

27reactions
pkyeckcommented, Dec 20, 2017

@CiGit no, sorry. thought I copy+pasted the important part.

This doesn’t work:

{
  "eslint.enable": true,
  "files.exclude": {
    "node_modules": true,
    ".npm-offline-cache": true
  },
  "editor.formatOnSave": false,
  "[javascript]": {
    "editor.formatOnSave": true
  }
}

This works:

{
  "eslint.enable": true,
  "files.exclude": {
    "node_modules": true,
    ".npm-offline-cache": true
  },
  "editor.formatOnSave": true,
  "[javascript]": {
    "editor.formatOnSave": true
  }
}

First version was working before the November update.

12reactions
eouw0o83hfcommented, Apr 17, 2019

Just so it shows up here explicitly as a comment, VS Code has a timeout for how long format-on-save actions are allowed to take. You can configure this with:

"editor.formatOnSaveTimeout": 750,

The default is 750 (in ms), but you can make it as high as you want. Moving up to 3000 fixed my problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS-Code Prettier Format On Save doesn't work - Stack Overflow
Try to make your code prettier manually by pressing CTRL + SHIFT + P >>> Format Document. If your file is being formatted...
Read more >
Format on Save (prettier) stopped working with latest update
formatOnSave , the problem is prettier stopped working, even manual formatting (SHIFT + ALT + F) wasn't working, and it worked again after ......
Read more >
VSCode Format On Save – everything you need to know
Troubleshoot : VSCode Format On Save not working · Choose a default formatter instead of null – the default value. · Uninstall other...
Read more >
How to fix Prettier Extension in VS Code - YouTube
I just updated VS Code and my prettier extension (to format all of my code) was not working. I didn't realize how much...
Read more >
How to use Prettier in VS Code - Robin Wieruch
A brief step by step tutorial on how to install and use Prettier in VS Code (Visual Studio Code). Prettier is an opinionated...
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