Open KotlinIsland opened 1 year 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.
Isn't this already possible? For me the following combination of options achieves this:
Run ruff when the python file is saved
Use ruff format (Experimental) for version 0.0.289 or later
pyproject.toml
file:
[tool.ruff.lint]
select = ['I'] # add more rules here as desired
fixable = ['I'] # add more rules here as desired
@urob that would lead to fixing everything, which is not desirable.
@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.
Oh right, yeah, read that backwards.
Your solution would lead to nothing else being fixed, which is not desirable.
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