mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
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:
parent
b54e390cb4
commit
cc0a5dd14a
6 changed files with 37 additions and 76 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue