astral-sh/ruff-vscode

Suboptimal order of Quick Fix actions when trying to import

StasDeep opened this issue · 3 comments

When I am trying to import a missing module, I press Opt+Enter to see the actions and with Ruff the most-used action in this situation ("Add import") is moved below the barely ever used "Disable for this line".

CleanShot 2024-10-03 at 10 53 41@2x

Is this misconfiguration on my side or is this sort of a bug?

IDE: Cursor v0.41.3

Ruff extension version: v2024.50.0

pyproject.toml:

[tool.ruff]
line-length = 120
target-version = "py310"

[tool.ruff.lint]
extend-select = [
    "I",  # sort imports
    "PLE",  # pylint errors
    "FIX",  # FIXME comments
]

Thanks for the report. The "Add 'import os'" code action isn't provided by Ruff. In general, all code actions that are provided by Ruff will be prefixed with "Ruff:". So, in this case, only the first code action is provided by Ruff.

@dhruvmanila is it possible to disable showing this specific action?

Yes, this option will avoid including the "Disable for this line" code action for all rules: https://docs.astral.sh/ruff/editors/settings/#disablerulecommentenable