mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Reduce extensive use of snapshot.query
(#11596)
This commit is contained in:
parent
204c59e353
commit
163c374242
8 changed files with 38 additions and 74 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue