python-lsp / python-lsp-ruff

Linter plugin for pylsp based on ruff.
MIT License
163 stars 23 forks source link

Handling of isort-related errors and other autofix codes #29

Open jhossbach opened 1 year ago

jhossbach commented 1 year ago

With #25 being merged soon, the question remains whether formatting should be enabled by default and error codes should be given to be auto-fixed when running formatting. I don't really mind on or the other, so I'm open to suggestions.

If e.g. isort-codes should be used for formatting per default, we should also disable pylsp-isort.

Shane-XB-Qian commented 1 year ago

i am curious to ask if this can offer 'additionalTextEdits' which offer auto-fix for auto-import when writing a method but did not import it yet.

jhossbach commented 1 year ago

That depends on whether ruff supports this kind of action. I couldn't find any immediate support for that, but as far as I know rope (and thus pylsp-rope) supports this.

Shane-XB-Qian commented 1 year ago

ohh, wish ruff supported it asap. // pylsp-rope seems a bit buggy, and wish ruff was the only one enhancement dependency of pylsp.

shane.xb.qian

jhossbach commented 1 year ago

You could create a feature request issue on ruff's github but i think the idea of ruff is to stay on providing linting features rather than code reformat actions. Nevertheless it might be worth the try.