10000 Why formatting fixes things I don't ask to fix? · Issue #68 · python-lsp/python-lsp-ruff · GitHub
[go: up one dir, main page]

Skip to content
Why formatting fixes things I don't ask to fix? #68
Open
@Onturenio

Description

@Onturenio

Hi, I'm fairly unfamiliar with ruff and formatting in general, and so I'm trying to understand how to control its behaviour.

I have this configuration:

"pylsp.plugins.ruff.enabled": true,
"pylsp.plugins.ruff.extendSelect": ["E", "D", "C90", "I"],
"pylsp.plugins.ruff.ignore": ["E265"],
"pylsp.plugins.ruff.format": ["D"],
"pylsp.plugins.ruff.preview": true,
"pylsp.plugins.ruff.lineLength": 79,

Then, I introduce this typo: a = 1. This gets correctly signaled by ruff with E221 (this code requires preview). However, when I run the command :call CocAction('format') this error gets fixed. This is not what I expect, the error should not be fixed because this family of errors is not explicitly indicated in the ruff.format option. This does seem to work for I errors, though.

Am I doing anything wrong or is this the expected behaviour? To be honest, I'm not even sure if :call CocAction('format') is the correct way to invoke ruff format.

Thanks for the the help and more generally for this great plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0