astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
946 stars 45 forks source link

Tilde won't expand in the config file path (specific to the vscode extension) #422

Closed MatrixRanger98 closed 4 months ago

MatrixRanger98 commented 4 months ago

I have a config file named ruff.toml in my directory. If I run ruff format . --config ~/ruff.toml, everything is fine. However, if I put the following settings in vscode

{
"ruff.format.args": ["--config","~/ruff.toml"]
}

then I got the error:

Ruff: Format failed (error: invalid value '~/ruff.toml' for '--config ' tip: A --config flag must either be a path to a .toml configuration file or a TOML <KEY> = <VALUE> pair overriding a specific configuration option It looks like you were trying to pass a path to a configuration file. The path ~/ruff.toml does not exist For more information, try '--help'.

charliermarsh commented 4 months ago

I believe this is fixed on main but not yet released!

charliermarsh commented 4 months ago

See: https://github.com/astral-sh/ruff/pull/10219. Will be fixed in the next release.

MatrixRanger98 commented 4 months ago

Thanks! And just confirmed that the current main works well.