Skip to content

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

Merged
snowsignal merged 1 commit intomainfrom
jane/server/user-settings
May 1, 2024
Merged

ruff server reads from a configuration TOML file in the user configuration directory if no local configuration exists#11225
snowsignal merged 1 commit intomainfrom
jane/server/user-settings

Conversation

@snowsignal
Copy link
Copy Markdown
Contributor

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
@snowsignal snowsignal force-pushed the jane/server/user-settings branch from dc01bc9 to 4de5bbf Compare May 1, 2024 01:47
@github-actions
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member

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

Copy link
Copy Markdown
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
@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