Reduce extensive use of snapshot.query (#11596)

This commit is contained in:
Micha Reiser 2024-05-29 10:11:46 +02:00 committed by GitHub
parent 204c59e353
commit 163c374242
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 74 deletions

View file

@ -10,7 +10,6 @@ use ruff_linter::{
use ruff_notebook::SourceValue;
use ruff_source_file::LineIndex;
use ruff_workspace::resolver::match_any_exclusion;
use ruff_workspace::FileResolverSettings;
use crate::{
edit::{Replacement, ToRangeExt},
@ -24,13 +23,14 @@ pub(crate) type Fixes = FxHashMap<lsp_types::Url, Vec<lsp_types::TextEdit>>;
pub(crate) fn fix_all(
query: &DocumentQuery,
file_resolver_settings: &FileResolverSettings,
linter_settings: &LinterSettings,
encoding: PositionEncoding,
) -> crate::Result<Fixes> {
let document_path = query.file_path();
let source_kind = query.make_source_kind();
let file_resolver_settings = query.settings().file_resolver();
// If the document is excluded, return an empty list of fixes.
if let Some(exclusion) = match_any_exclusion(
document_path,