Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff server reads from a configuration TOML file in the user configuration directory if no local configuration exists #11225

Merged
merged 1 commit into from
May 1, 2024

Conversation

snowsignal
Copy link
Member

Summary

Fixes #11158.

A settings file in the ruff user configuration directory will be used as a configuration fallback, if it exists.

Test Plan

Create a pyproject.toml or ruff.toml configuration file in the ruff user configuration directory.

  • On Linux, that will be $XDG_CONFIG_HOME/ruff/ or $HOME/.config
  • On macOS, that will be $HOME/Library/Application Support
  • On Windows, that will be {FOLDERID_LocalAppData}

Then, open a file inside of a workspace with no configuration. The settings in the user configuration file should be used.

@snowsignal snowsignal added the server Related to the LSP server label May 1, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@akthe-at
Copy link

akthe-at commented May 1, 2024

Summary

Fixes #11158.

A settings file in the ruff user configuration directory will be used as a configuration fallback, if it exists.

Test Plan

Create a pyproject.toml or ruff.toml configuration file in the ruff user configuration directory.

  • On Linux, that will be $XDG_CONFIG_HOME/ruff/ or $HOME/.config
  • On macOS, that will be $HOME/Library/Application Support
  • On Windows, that will be {FOLDERID_LocalAppData}

Then, open a file inside of a workspace with no configuration. The settings in the user configuration file should be used.

I could be reading this wrong but wouldn't the windows directory listed above end up being something like "%USERPROFILE%\AppData\Local" ? The current global config for ruff if not local is looked for in "${config_dir}/ruff/pyproject.toml" correct? Is it by design/desired to have these be different toml files or are they meant/able to live together in the same config toml file?

@charliermarsh
Copy link
Member

The logic here is the same as elsewhere in Ruff -- it'll look in the same place.

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected more changes. This makes it look extremely easy 😆

@snowsignal snowsignal merged commit 068e22d into main May 1, 2024
19 checks passed
@snowsignal snowsignal deleted the jane/server/user-settings branch May 1, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ruff server should check find_user_settings_toml() if no file configuration exists
4 participants