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. https://github.com/astral-sh/ruff/assets/67177269/e8969128-c175-4f98-8114-0d692b906cc8
This commit is contained in:
@@ -2,10 +2,10 @@ use lsp_types::{self as types, request as req};
|
||||
use types::TextEdit;
|
||||
|
||||
use ruff_source_file::LineIndex;
|
||||
use ruff_workspace::resolver::match_any_exclusion;
|
||||
|
||||
use crate::edit::{Replacement, ToRangeExt};
|
||||
use crate::fix::Fixes;
|
||||
use crate::resolve::is_document_excluded;
|
||||
use crate::server::api::LSPResult;
|
||||
use crate::server::{client::Notifier, Result};
|
||||
use crate::session::{DocumentQuery, DocumentSnapshot};
|
||||
@@ -85,14 +85,12 @@ fn format_text_document(
|
||||
|
||||
// If the document is excluded, return early.
|
||||
if let Some(file_path) = query.file_path() {
|
||||
if let Some(exclusion) = match_any_exclusion(
|
||||
if is_document_excluded(
|
||||
&file_path,
|
||||
&file_resolver_settings.exclude,
|
||||
&file_resolver_settings.extend_exclude,
|
||||
file_resolver_settings,
|
||||
None,
|
||||
Some(&formatter_settings.exclude),
|
||||
Some(formatter_settings),
|
||||
) {
|
||||
tracing::debug!("Ignored path via `{}`: {}", exclusion, file_path.display());
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use lsp_types::{self as types, request as req, Range};
|
||||
|
||||
use ruff_workspace::resolver::match_any_exclusion;
|
||||
|
||||
use crate::edit::{RangeExt, ToRangeExt};
|
||||
use crate::resolve::is_document_excluded;
|
||||
use crate::server::api::LSPResult;
|
||||
use crate::server::{client::Notifier, Result};
|
||||
use crate::session::{DocumentQuery, DocumentSnapshot};
|
||||
@@ -50,14 +49,12 @@ fn format_text_document_range(
|
||||
|
||||
// If the document is excluded, return early.
|
||||
if let Some(file_path) = query.file_path() {
|
||||
if let Some(exclusion) = match_any_exclusion(
|
||||
if is_document_excluded(
|
||||
&file_path,
|
||||
&file_resolver_settings.exclude,
|
||||
&file_resolver_settings.extend_exclude,
|
||||
file_resolver_settings,
|
||||
None,
|
||||
Some(&formatter_settings.exclude),
|
||||
Some(formatter_settings),
|
||||
) {
|
||||
tracing::debug!("Ignored path via `{}`: {}", exclusion, file_path.display());
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user