Directly include Settings struct for the server (#16042)

## Summary

This PR refactors the `RuffSettings` struct to directly include the
resolved `Settings` instead of including the specific fields from it.
The server utilizes a lot of it already, so it makes sense to just
include the entire struct for simplicity.

### `Deref`

I implemented `Deref` on `RuffSettings` to return the `Settings` because
`RuffSettings` is now basically a wrapper around it with the config path
as the other field. This path field is only used for debugging
("printDebugInformation" command).
This commit is contained in:
Dhruv Manilawala 2025-02-10 10:20:01 +05:30 committed by GitHub
parent b54e390cb4
commit cc0a5dd14a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 76 deletions

View file

@ -27,15 +27,14 @@ pub(crate) fn fix_all(
encoding: PositionEncoding,
) -> crate::Result<Fixes> {
let source_kind = query.make_source_kind();
let file_resolver_settings = query.settings().file_resolver();
let settings = query.settings();
let document_path = query.file_path();
// If the document is excluded, return an empty list of fixes.
let package = if let Some(document_path) = document_path.as_ref() {
if is_document_excluded_for_linting(
document_path,
file_resolver_settings,
&settings.file_resolver,
linter_settings,
query.text_document_language_id(),
) {
@ -71,7 +70,7 @@ pub(crate) fn fix_all(
&query.virtual_file_path(),
package,
flags::Noqa::Enabled,
query.settings().unsafe_fixes(),
settings.unsafe_fixes,
linter_settings,
&source_kind,
source_type,