astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
1.06k stars 53 forks source link

Config argument specificied in `ruff.lint.args` is ignored by the formatter #405

Closed luctowers closed 7 months ago

luctowers commented 7 months ago

settings.json

{
    "ruff.lint.args": ["--config=/path/to/.ruff.toml"]
}

/path/to/.ruff.toml

line-length = 80
indent-width = 4
[format]
quote-style = "double"
indent-style = "tab"

Operating System: Debian (Devcontainer running on Docker for Mac) Python Version: 3.12 Ruff Version: 0.2.1 Extension Version: v2024.10.0

When I format my python code with the above setup it does not obey the config file.

Setups that do work for me:

  1. Placing the .ruff.toml in the root of my project
  2. Manually formatting with ruff format --config=/path/to/.ruff.toml
charliermarsh commented 7 months ago

Ah sorry, you need to specify the config file for the format command:

{
    "ruff.format.args": ["--config=/path/to/.ruff.toml"]
}
luctowers commented 7 months ago

I see, awesome thanks :)