Reformat On Save doesn't work
Answered
Hi! I'm using IntelliJ 2023.1.1.
When I try to save a file it doesn't run Prettier or ESLint, while I have this on Actions on Save:
Tried it with adding a lot of extra lines to it, but NO success.
If I right click in the file and click on Reformat with Prettier this does work. Of course I don't want to right click in each file after a change but this must be automatically. How can this be fixed?
Please sign in to leave a comment.
Hello,
Could you please check the issue with the latest stable build?
I've downloaded version 2023.2 now but it doesn't make any difference.
Could you please share idea.log ("Help | Show Log in...") after restarting IDE and reproducing the issue?
I can't share the file here. Can only upload images with a max of 2Mb.
Also after the update to the latest version of IntelliJ the items in the menus are very close to eachother.
Yaroslav Bedrov could you re-open? Still have no answer how to reformat on save getting to work.
Please share files via https://uploads.jetbrains.com/ form.
Upload id: 2023_08_21_nyZvLLcpAKVEZPyNukfZSM (file: idea.log)
Please upload full logs folder zipped. Provided file contains a lot of warnings so some needed information is missing there.
Upload id: 2023_08_22_ZbveS5oYAiYkazJNp7tAk4 (file: idea.zip)
Is it full folder? Seems archive contains single log file.
What do you mean with full folder?
I need all files from logs folder.
Hereby all files: Upload id: 2023_08_22_f5FvZyTNHYDUsmVdiu9uas (file: idea.zip)
Thanks! Could you please try to temporarily disable custom plugins: "Loaded custom plugins: Material Theme UI (8.11.0), Go Linter (1.6.6), Save Actions Tool (2.6.1), Tailwind Formatter (2.0.8), Kubernetes (232.8660.158), PHP (232.8660.205), Go (232.8660.142), Bash Cmd (1.0.0), Add to gitignore (0.3)"? Will it help?
I tried with disabling all the those plug-ins, but reformat on save still doesn't work.
Could you please provide one more test - will it work if:
1. Only "Reformat" option is selected
2. Only "Prettier" option is selected
This is also doesn't work :-(
When I've the changes, I got this pop-up now on my laptop.
When I've entered my company credentials I get this error:
C:\Program Files\nodejs\node.exe
The requested operation requires elevation.
Am I got you right that even internal “Reformat” doesn't work? Could you please check the issue with other files types (e.g. Java) when “Reformat" is the only selected option.
Yes, you are right that this also doesn't work. I've tried it with .vue and .ts files.
Also when I try to change settings by (un)checking “Reformat code”, I get the popup like the screenshot above.
Could you please try to run IDE with default settings ("File | Manage IDE Settings | Restore Default settings"), then configure “On Save” actions to “Reformat” only and check the issue on Java file and JavaScript file? We need to check if it's general issue or JS related.
Yes, tried Restore Default Setting and “Reformat” only with a .js file but still no results.
I don't know, but I think this has someting to do with the error that I was menting above with node.exe…
Could you please check the issue with Java file? So we could localize the issue.
The Java-file doesn't work also. Even not with right-click “Reformat with Prettier”.
So, leaving only “Reformat” option, adding some extra indents in Java file and saving it doesn't remove indents? Is anything changes in Java file if you run “Code | Reformat code”?
Yes, that does not work. Tried adding extra indents, some extra lines, etc but it doesn't work on saving the file.
If I click “Code | Reformat code”, it does work but I don't want to click on this manually.
Unfortunately, I still couldn't reproduce the issue on my side. Could you please provide one more log after restarting IDE, editing Java file and saving it (with only “Reformat” option selected)?
Here we go again: Upload id: 2023_08_30_biJreeoU62gMnSD7kHNQuQ (file: idea.1.zip)
1. Restarted IDE
2. Double checked that Reformat was only checked
3. Created a Java file
4. Created extra indents and line breaks
5. Saved the file
No improvements.
I reported issue on YouTrack:https://youtrack.jetbrains.com/issue/IDEA-331214
Please follow it for updates.