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?

0
29 comments

Hello,

Could you please check the issue with the latest stable build?

0

I've downloaded version 2023.2 now but it doesn't make any difference.

0

Could you please share idea.log ("Help | Show Log in...") after restarting IDE and reproducing the issue?

0

I can't share the file here. Can only upload images with a max of 2Mb.

0

Also after the update to the latest version of IntelliJ the items in the menus are very close to eachother.

0

Yaroslav Bedrov could you re-open? Still have no answer how to reformat on save getting to work.

0

Upload id: 2023_08_21_nyZvLLcpAKVEZPyNukfZSM (file: idea.log)

0

Please upload full logs folder zipped. Provided file contains a lot of warnings so some needed information is missing there.

0

Upload id: 2023_08_22_ZbveS5oYAiYkazJNp7tAk4 (file: idea.zip)

0

Is it full folder? Seems archive contains single log file.

0

What do you mean with full folder?

0

I need all files from logs folder.

0

Hereby all files: Upload id: 2023_08_22_f5FvZyTNHYDUsmVdiu9uas (file: idea.zip)

0

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?

0

I tried with disabling all the those plug-ins, but reformat on save still doesn't work.

0

Could you please provide one more test - will it work if:

1. Only "Reformat" option is selected

2. Only "Prettier" option is selected

0

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.

0

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. 

0

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.

0

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.

0

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…

0

Could you please check the issue with Java file? So we could localize the issue.

0

The Java-file doesn't work also. Even not with right-click “Reformat with Prettier”.

0

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”?

0

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.

0

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)? 

0

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.

0

 I reported issue on YouTrack:https://youtrack.jetbrains.com/issue/IDEA-331214

Please follow it for updates.

0

Please sign in to leave a comment.