koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
173 stars 6 forks source link

(🎁) "organize imports" integration #140

Open KotlinIsland opened 1 year ago

KotlinIsland commented 1 year ago

the vscode extension has options/commands for:

I think that it would be beneficial if this plugin had a separate "organise imports" option like the vscode extensions does.

See com.intellij.lang.ImportOptimizer

Funding

Fund with Polar

johnthagen commented 6 months ago

This would be awesome.

My current work around is to run

$PyInterpreterDirectory$/python -m ruff check --select I --fix $FilePath$

as part of a File Watcher

Having this be a simple option to "sort imports on save" built into the plugin would be save a lot of manual configuration for each user.

urob commented 1 month ago

Isn't this already possible? For me the following combination of options achieves this:

KotlinIsland commented 1 month ago

@urob that would lead to fixing everything, which is not desirable.

urob commented 1 month ago

@urob that would lead to fixing everything, which is not desirable.

Not sure I follow. The I rules are just for organizing the imports. You could be even more specific and only specify I001.

I'm using something very similar to this and there aren't any additional linter fixes that are automatically applied for me.

KotlinIsland commented 1 month ago

Oh right, yeah, read that backwards.

Your solution would lead to nothing else being fixed, which is not desirable.