InSyncWithFoo / ryecharm

The all-in-one PyCharm plugin for Astral-backed Python tools
https://insyncwithfoo.github.io/ryecharm/
MIT License
82 stars 3 forks source link

Add option to run ruff check --fix on save #3

Closed michalmo closed 2 months ago

michalmo commented 2 months ago

Feature or enhancement

RyeCharm already supports format on save, but applying safe lint fixes on save is missing but equally useful. koxudaxi/ruff-pycharm-plugin supports this, as well as similar integrations for tools for other languages eg. biomejs/biome-intellij. Not that i've grown used to it it hard to switch to RyeCharm without it :)

Proposed solution

Add an on save action to apply fixes to the current file.

Alternatives considered

No response

Additional context

Good job 👍, this integration is looking quite nice already.

InSyncWithFoo commented 2 months ago

Thanks for using RyeCharm. Try out the new build at #4 (see the installation guide) and let me know if it works for you. The new setting doesn't fit quite well into the "formatting" subgroup, so I might eventually move it to elsewhere, but this should do for now.

michalmo commented 2 months ago

Hi, thanks for the quick update. I had to update to Pycharm 2024.2.2 RC to install it (though I see you've since reverted that), but it doesn't seem to be working.

If I enable the new "Also fix safely fixable violations" option, it does apply the fixes, but no longer does formatting. Formatting works again after disabling the option.

InSyncWithFoo commented 2 months ago

Interesting. I suppose this is due to a race condition. I'll do a more thorough fix tomorrow.

InSyncWithFoo commented 2 months ago

Done. The new build should now do its job properly.

michalmo commented 2 months ago

The new build works great 👍