-
-
Notifications
You must be signed in to change notification settings - Fork 458
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
Changes to prettier.config.js don't take effect until restarting vscode when using prettier v3 #3179
Comments
I'm finding that even a |
@yCodeTech you may be seeing a separate but related issue: when using a json config file, you need to switch tabs before the change will take effect. If you edit the config file and immediately try to format the same file, it won't use the updated config, but as soon as you change to another tab (and optionally back to the config file), it should work. (But with a js config file, switching tabs doesn't fix it.) |
@russelldavis While that is working now, it definitely wasn't working before. Also, you kinda have to switch tabs anyway if you're not using the side by side layout... edit the prettier json file and then switch to the file you want to format. Perhaps there's an inconsistent bug where sometimes changing tabs updates the prettier to use the new changes, and sometimes it doesn't? |
Thanks @russelldavis . Same problem here too. I saw a similar problem reported in this #584 issue, but I noticed that it was closed. In my case, whenever I make any changes to the |
Same issue. Couldn't understand why my config wasn't working like it should, only to see in the Output console that it's using a config file from weeks ago. Had to restart VSCode to work. |
I think this is because in Prettier v3, Update: Just to be clear, there're some updates regarding the config resolution in the recent month but even before the update (before There're several workarounds (for prettier devs, not extension users) mentioned in that issue:
There may be some other ways in the discussion but I don't fully understand them with my current knowledge. Both of the two above mentioned methods will have some performance penalties if they're called frequently, unless there's a way to watch whether the content of the config file is updated or not. I myself is also trying to implement a config resolution mechanism just like the one in Prettier and I encountered this problem, too. I used the first workaround mentioned above (the worker one), because IMO it doesn't suffer from the IO delay, and thankfully it works. If anyone is interested, the related code can be found here and here |
I'm still having the same issue with the most recent Prettier version |
Also encountering and would be happy to see this resolved. |
This issue has been labeled as stale due to inactivity. Reply to keep this issue open. |
Devs??? Fix issue please. |
I get the same issue in vscode with .prettierrc config file. To make prettier use the edited config, it's either I restart the extension host or I restart vscode |
Just encountered this. Changes to |
Just created new next.js project, and encountered issue, while configuring |
This is still happening |
Summary
Under certain conditions, changes to prettier config don't take effect until restarting vscode. The bug only happens when both of these are true:
Github Repository to Reproduce Issue
https://github.com/russelldavis/repro-vscode-prettier-stale-config
Steps To Reproduce:
prettier.config.cjs
(e.g., change tabWidth to 8) and save the file.Format Document
on any file.Expected result
The document should be formatted using the updated config.
Actual result
The document is formatted using the old config. To make the new config take effect, you have to reload the window or restart vscode.
Additional information
VS Code Version:
Version: 1.83.1
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:57:32.750Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0
Prettier Extension Version:
v10.1.0
OS and version:
macOS 13.5.2
Prettier Log Output
The text was updated successfully, but these errors were encountered: