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.

Format document not running prettier?

See original GitHub issue

What’s the best way to diagnose this issue? I have prettier installed and enabled. It used to work fine. I don’t know when exactly it stopped working. When I have for instance this:

  <p>test</p>
<Modal     open={this.state.addingReview}        ></Modal>

And run Format Document, it results in this:

<p>test</p>
<Modal open={this.state.addingReview}      ></Modal>

Whereas running prettier from the command line results in:

<p>test</p>
<Modal open={this.state.addingReview} />

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:36 (4 by maintainers)

github_iconTop GitHub Comments

106reactions
CiGitcommented, Mar 9, 2018

@lorensr Seems the extension did not start. Can you take a look at dev console? Help -> toggle developer tools -> console

Try reinstalling:

  • Uninstall extension
  • Close VSCode
  • Be sure $HOME/.vscode{,-insider}/extensions/esbenp.prettier-vscode-1.2.2 doesn’t exist
  • Install extension
34reactions
sstimaccommented, Mar 9, 2018

What happened in my case, is VSC update deleted some of my user settings, one of which was the formatOnSave , which is why the extension seemed broken ( as i’m used to format on save ).

Setting the property back was easy enough. If that’s the case, check if you have "editor.formatOnSave": true set within the settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Prettier not format code in VS Code? - Stack Overflow
Click on Preferences: Open Settings (JSON) from the suggestion dropdown. Inside the settings.json file, Check if "[html]" key exists. If the key ...
Read more >
Format on Save (prettier) stopped working with latest update
Same thing happened to me just now. I set prettier as the Default Formatter in Settings and it started working again. My Default...
Read more >
Prettier not working in VSCode – possible fixes - LinuxPip
In VSCode, open a HTML/JS file and open the Command Palette by selecting View > Command Palette or press Ctrl+Shift+P and search for...
Read more >
Prettier stopped working in VS Code - DeveloperF1.com
Open settings by pressing CTRL + , or using the menu item File -> Preferences -> Settings · Type default formatter into the...
Read more >
How To Use Prettier in VS Code - Alphr
1. Open VS Code and press the Extensions icon. 2. Input “Prettier” in the search bar and hit the magnifying glass icon. 3....
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