Use tool specific function to perform exclude checks (#15486)

## Summary

This PR creates separate functions to check whether the document path is
excluded for linting or formatting. The main motivation is to avoid the
double `Option` for the call sites and makes passing the correct
settings simpler.
This commit is contained in:
Dhruv Manilawala 2025-01-15 13:18:46 +05:30 committed by GitHub
parent aefb607405
commit bec8441cf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 17 deletions

View file

@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use crate::{
edit::{NotebookRange, ToRangeExt},
resolve::is_document_excluded,
resolve::is_document_excluded_for_linting,
session::DocumentQuery,
PositionEncoding, DIAGNOSTIC_NAME,
};
@ -73,11 +73,10 @@ pub(crate) fn check(
// If the document is excluded, return an empty list of diagnostics.
let package = if let Some(document_path) = document_path.as_ref() {
if is_document_excluded(
if is_document_excluded_for_linting(
document_path,
file_resolver_settings,
Some(linter_settings),
None,
linter_settings,
query.text_document_language_id(),
) {
return DiagnosticsMap::default();