Skip to content

Conversation

@TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Nov 24, 2025

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
Copy link
Contributor Author

TimothyMakkison commented Nov 25, 2025

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 TimothyMakkison force-pushed the global_save branch 2 times, most recently from 5f2c76d to 4b9f259 Compare November 25, 2025 21:35
@belav
Copy link
Owner

belav commented Nov 26, 2025

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.

@martindisch
Copy link
Contributor

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
Copy link
Contributor

I gave it another shot in #1766 and it seems to work. It doesn't use layers though, just changes everything to global settings.

@TimothyMakkison
Copy link
Contributor Author

TimothyMakkison commented Dec 4, 2025

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.

@belav
Copy link
Owner

belav commented Dec 14, 2025

Based on the other PR plus some work I tried today, it doesn't seem like there is any way to get settings into This Computer. At least not while this is an intellij plugin.

Another possibility would be to have a whole section called CSharpier (global settings) and include all of the settings there. I don't know if it is worth that extra effort. So I think sticking with this makes sense unless you or @martindisch feel strongly about having a whole section with all of the options available to set globally.

I do think this should modify RunOnSave to be a nullable boolean. That way someone can always override the global value whether it is true or false.

The way VS handles it is a nullable boolean behind the scenes but a drop down with an empty option for the null value.

image

@TimothyMakkison
Copy link
Contributor Author

TimothyMakkison commented Dec 14, 2025

This is my current approach, I've included some migration logic to avoid the issues mentioned in my previous comment.
Its backed by an enum not sure if this is the best approach. I'd appreciate some naming advice
image

@TimothyMakkison
Copy link
Contributor Author

TimothyMakkison commented Dec 14, 2025

I've implemented my previous idea. I opted to add a new ProjectRunOnSaveOption setting. If the previous runOnSave was True, projectRunOnSaveOption becomes ProjectRunOnSaveOption.RunOnSave and resets runOnSave. Otherwise we default to ProjectRunOnSaveOption.SoftNeverRun for new and existing projects. This way Global run on save will be able to override projects by default but we also have the option to override this behaviour at the project level with Never run on save.

  • Naming is not final, I'm not sure if users would understand the difference between Don't run on save and Never run on save.
  • I do not regularly write Java any feedback would be appreciated
  • It might be worth updating runOnSave when projectRunOnSaveOption changes on the off change someone downgrades versions, I doubt this would be a common problem
  • IntelliJ does have a build in settings migrator, I have no idea how to use this as the documentation is terrible. I'm not convinced it would actually be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants