Skip to content

Commit

Permalink
ruff server: Editor settings are used by default if no file-based c…
Browse files Browse the repository at this point in the history
…onfiguration exists (#11266)

## Summary

Fixes #11258.

This PR fixes the settings resolver to match the expected behavior when
file-based configuration is not available.

## Test Plan

In a workspace with no file-based configuration, set a setting in your
editor and confirm that this setting is used instead of the default.
  • Loading branch information
snowsignal committed May 4, 2024
1 parent 6587dc1 commit c4bf783
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/ruff_server/src/session/workspace/ruff_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ impl RuffSettingsIndex {
)
.ok()
})
.unwrap_or_default();
.unwrap_or_else(|| {
let default_configuration = ruff_workspace::configuration::Configuration::default();
EditorConfigurationTransformer(editor_settings, root)
.transform(default_configuration)
.into_settings(root)
.expect(
"editor configuration should merge successfully with default configuration",
)
});

Self {
index,
Expand Down

0 comments on commit c4bf783

Please sign in to comment.