Conside include, extend-include for the native server (#12252)

## Summary

This PR updates the native server to consider the `include` and
`extend-include` file resolver settings.

fixes: #12242 

## Test Plan

Note: Settings reloading doesn't work for nested configs which is fixed
in #12253 so the preview here only showcases root level config.

e8969128-c175-4f98-8114-0d692b906cc8
This commit is contained in:
Dhruv Manilawala 2024-07-10 09:42:57 +05:30 committed by GitHub
parent 855d62cdde
commit 0bb2fc6eec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 101 additions and 47 deletions

View file

@ -9,10 +9,10 @@ use ruff_linter::{
};
use ruff_notebook::SourceValue;
use ruff_source_file::LineIndex;
use ruff_workspace::resolver::match_any_exclusion;
use crate::{
edit::{Replacement, ToRangeExt},
resolve::is_document_excluded,
session::DocumentQuery,
PositionEncoding,
};
@ -33,18 +33,12 @@ pub(crate) fn fix_all(
// If the document is excluded, return an empty list of fixes.
let package = if let Some(document_path) = document_path.as_ref() {
if let Some(exclusion) = match_any_exclusion(
if is_document_excluded(
document_path,
&file_resolver_settings.exclude,
&file_resolver_settings.extend_exclude,
Some(&linter_settings.exclude),
file_resolver_settings,
Some(linter_settings),
None,
) {
tracing::debug!(
"Ignored path via `{}`: {}",
exclusion,
document_path.display()
);
return Ok(Fixes::default());
}