intellij-plugin-save-actions icon indicating copy to clipboard operation
intellij-plugin-save-actions copied to clipboard

Rider/C# - Formatting actions have no effect

Open actforjason opened this issue 3 months ago • 3 comments

Checklist

  • [x] I am able to reproduce the bug with the latest version
  • [x] I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • [x] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • [x] This issue contains only one bug.

Affected version

save-actions 1.5.0,Rider 2025.2.0.1

Description of the problem

The file is saved but not formatted with Save All.

Steps to reproduce the bug

Settings are as follows, Image

Additional information

No response

actforjason avatar Aug 29 '25 05:08 actforjason

Thank you for the issue, I can reproduce the problem with Rider.

So the problem here is that in https://github.com/JetBrains/intellij-community/blob/64124b0ee1ab4cab228051dcbd4455eef2097464/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java#L339 LanguageFormatting.INSTANCE.forContext(psiFile) always returns null for C#.

It looks like there is a problem with Rider's definition of C# as it's not registered as a language inside the IDE? There are no extension points for C# in com.intellij.lang.formatter and com.intellij.metaLanguage.

Also running Reformat code (Ctrl + Alt + L) in Rider does not trigger the ReformatCodeProcessor.

There is also no Reformat code action present in Actions on Save just a custom one called Reformat code and cleanup: Image

Rider source code is also not publicly available (and written in Kotlin so I can't decompile it properly), so it's kind of hard to say what's going on in there...

AB-xdev avatar Sep 01 '25 10:09 AB-xdev

The other formatting options like Optimize imports and Rearrange fields... also don't seem to work...

AB-xdev avatar Sep 01 '25 11:09 AB-xdev

I reported the problem to JetBrains: https://youtrack.jetbrains.com/issue/RIDER-129474

AB-xdev avatar Sep 01 '25 11:09 AB-xdev