Open urob opened 1 year ago
Do the automatic background formatting and the context action use the same ruff process behind the scenes, or are they generated using different processes? If the latter, it seems that adding the fixable=ALL
CLI option to the process that generates the context actions might do the trick? Perhaps one could make this optional with a "overwrite fixable for context actions" setting?
I'm sorry my late reply.
The plugin calls ruff
command every time. It means ruff uses configs on pyproejct.toml
.
Also, the entry point is individual we can add specific an argument per plugin feature.
Perhaps the easiest/most flexible approach would be to add options to add custom CLI options to ruff
for the different entry points? (context action menu, auto fix on format/save)
This way the issue described here could be addressed by the user by adding fixable=ALL
to the context action instances of ruff. Someone else could decide to overwrite the default pyproject.toml for the auto fix on format, or use the feature to configure ruff as suggested in #135.
First, thanks for making this plugin! This is great.
I realize that this may require coordination with the upstream
ruff
project but since this primarily affects the IDE integration, I am opening it here.Context
I am using ruff's
fixable
andunfixable
setting to disable autofixing certain rules on save / when re-formatting.The problem is that this also eliminates the auto-fix suggestions in the context actions menu, even if the corresponding rule is enabled. This is unfortunate, because even if one does not want a rule to be auto-fixed in the background when saving/reformatting, it is still reasonable that one would like to manually apply the auto-fix on a case-by-case basis using the context action menu.
Suggestion
My opinionated suggestion would be to simply ignore the
fixable
andunfixable
settings for the context action menu. The argument is that offering a context action fix is pretty unobtrusive and, considering that a user chose to enable a given rule in the first place, they probably also would occasionally want to apply an existing auto-fix (even if they don't want to do so automatically).Funding