astral-sh / ruff-vscode

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

A problem when using format file for ruff in Windows and Linux #441

Open DK05310214 opened 7 months ago

DK05310214 commented 7 months ago

I'm using Ruff for code formatting across different systems and have hit a snag with specifying a format file path in my settings. This setup causes an error when switching systems because the file path is not recognized on the new platform.

Is there a way to make Ruff dynamically adjust the file path based on the operating system it's running on? This would greatly enhance its usability in multi-OS environments.

image

MichaReiser commented 7 months ago

@DK05310214 no, Ruff has no such functionality. I understand that you want to configure different paths on different systems (/platforms?) because the file is stored at a different location.

CC: @snowsignal I think this is interesting when thinking about the new settings

DK05310214 commented 7 months ago

@DK05310214 no, Ruff has no such functionality. I understand that you want to configure different paths on different systems (/platforms?) because the file is stored at a different location.

CC: @snowsignal I think this is interesting when thinking about the new settings

Thanks for reply. I think this feature may be very useful. The paths to configuration file can be set as a list. We can iterate through this list to search for configuration file and pass the file that found for the first time to ruff.

MichaReiser commented 7 months ago

Would it work if you place the file in your home directory and pass a relative path --config ~/path/to/ruff.toml ?