Prettier-vscode: formatOnSave not firing

Created on 9 May 2018  路  17Comments  路  Source: prettier/prettier-vscode

Like #440, #441, and others, I too am having issues with Prettier after the 1.23.0 update, but slightly different. If I use the > Format Document from the command panel dropdown, it works, but it doesn't format on save anymore.

I have looked through the different logs in Output tab, but don't see anything that seems to be an error.

In my vscode settings I have only these settings with nothing else

{
    "editor.formatOnSave": false,
    "[javascript]": {
        "editor.formatOnSave": true
    }
}


As (mostly) seen in this screen shot, I have all my extensions, except this one, disabled.

image

locked

Most helpful comment

I was having a similar problem with .tsx files. @kyleknighted's fix worked for me (with a slight tweak):

"[typescriptreact]": {
  "editor.formatOnSave": true
},

All 17 comments

Getting lots of these in the logs

[2018-05-08 19:24:50.456] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:31:28.660] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:32:07.968] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:33:32.767] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:39:17.517] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:40:28.277] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:42:03.240] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:42:22.147] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:42:45.738] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:50:08.204] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:52:32.487] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:52:50.958] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:54:42.975] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 19:56:16.523] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 20:07:29.161] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 20:10:19.509] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms
[2018-05-08 20:10:21.286] [renderer1] [warning] Aborted onWillSaveTextDocument-event after 1750ms

Did you restart (not reload) after disabling every other extensions ?
There seems to be an extension taking too much time on save.

@CiGit i've reloaded and restarted VSCode probably 50 times while slowly enabling/disabling plugins as well as adding and removing settings.

Also, even with only this plugin being active it still doesn't format on save, but I also don't get that warning message.

I'm having the same issue, though I can't seem to find any similar log messages.

What file type (language id) are you trying to format?

JavaScript
image

I think I figured it out. The settings were in the workspace file, but I had the folder opened, not the workspace. My mistake. Sorry! Maybe that's their problem as well?

@CiGit The languages are JS and JSX
@cmrigney My settings are all in the User Settings, all my projects follow the same coding patterns.

Disabling https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag seemed to fix format no save not happening in my tsx environment.

@AndyBan thank you for the suggestion, but I do not that have plugin installed, the issue remains with all plugins disabled.

@CiGit I downloaded and overwrote my current VSCode app with a fresh package, and the issue still remains. At this point I'm not sure what's left to try besides wiping out everything related to VSCode and setting my environment up from scratch.

Can you disable other extensions AND set editor.formatOnSave: true for all languages AND restart (not reload) VSCode ?

If it's not a conflict trouble, the thing left is trying to debug this extension

Looks like adding

"[javascriptreact]": {
    "editor.formatOnSave": true
},

appears to fix the issue. I didn't realize VSCode differentiated between the two.
I've got my plugins enabled and everything appears to be working again.
I'm curious as to how it worked before without this specific language, but I guess as long as it works now... :)

Thanks for helping me debug. Closing the issue.

You can do jsx in .js files.
It seems there was an extension "JSX is JS" or something like that in the past.

I was having a similar problem with .tsx files. @kyleknighted's fix worked for me (with a slight tweak):

"[typescriptreact]": {
  "editor.formatOnSave": true
},

I concur with @kyledetella. That also fixed the issue for me.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings