csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

feat: add global run on save option

Open TimothyMakkison opened this issue 1 month ago • 5 comments

Full disclosure, I rarely use Java, no idea if this works, not sure how to debug plugins. I'm hoping the CI has a test for this.

Edit: Looks like I need to install Java 😭

#1739

TimothyMakkison avatar Nov 24 '25 22:11 TimothyMakkison

image

Got it working, setting persists between projects now 👍

I opted to put both settings under the same header, did wonder if it should say Run on save (Enabled globally).

TimothyMakkison avatar Nov 25 '25 00:11 TimothyMakkison

Intellij has the idea of layers so implementing this as a global setting needs to be done that way instead of adding another option. I'm not sure what needs to be done but a global setting is just one that can be saved at the "my computer" layer. And then if needed the csharpier plugin code needs to make sure the more specific layer setting takes priority.

VS has a separate global setting because at least for 2022 and earlier there was nothing built-in that allowed it. I haven't looked into 2026 yet to see how the new settings work but I'm hoping it is closer to vscode.

belav avatar Nov 26 '25 01:11 belav

Thanks for starting work on this :-) This will be super useful, because in our organization it unfortunately happens frequently enough that people open a new solution, don't have run on save enabled for it, and get frustrated by a build error in CI. The pain has gotten bad enough that our platform team is planning to build autoformatting into CI that will create an "autofix" branch to merge into the PR branch on formatting errors.

If we can get the Rider plugin to reliably work in all repositories one opens, we can make this a much better experience.

martindisch avatar Dec 01 '25 10:12 martindisch

I gave it another shot in https://github.com/belav/csharpier/pull/1766 and it seems to work. It doesn't use layers though, just changes everything to global settings.

martindisch avatar Dec 03 '25 12:12 martindisch

Intellij has the idea of layers so implementing this as a global setting needs to be done that way instead of adding another option. I'm not sure what needs to be done but a global setting is just one that can be saved at the "my computer" layer.

I tried doing this but I couldn't find any examples - online documentation wasn't very helpful with a lot of dead links/github repos, AI's were a little better. I'm curious to know if @martindisch found anything relevant when doing #1766. I found documentation for layered settings with Resharper, but nothing for jvm rider plugins.

And then if needed the csharpier plugin code needs to make sure the more specific layer setting takes priority.

I could modify this PR to do this, I can't just have the project settings always override the global one, because the project setting defaults to false, preventing the global on save from ever doing anything. It might be possible to migrate to a newer system where we have a new Enum for project on save settings True, False (default), Override False. With the current False -> False (default) with users opting to use Override False as needed.

VS has a separate global setting because at least for 2022 and earlier there was nothing built-in that allowed it. I haven't looked into 2026 yet to see how the new settings work but I'm hoping it is closer to vscode.

Docs here, not sure if VisualStudio.Extensibility is as backwards compatible as the current version.

TimothyMakkison avatar Dec 04 '25 00:12 TimothyMakkison