Respect file exclusions in ruff server (#11590)

## Summary

Closes https://github.com/astral-sh/ruff/issues/11587.

## Test Plan

- Added a lint error to `test_server.py` in `vscode-ruff`.
- Validated that, prior to this change, diagnostics appeared in the
file.
- Validated that, with this change, no diagnostics were shown.
- Validated that, with this change, no diagnostics were fixed on-save.
This commit is contained in:
Charlie Marsh 2024-05-28 22:58:36 -04:00 committed by GitHub
parent 531ae5227c
commit 204c59e353
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 235 additions and 43 deletions

View file

@ -479,7 +479,7 @@ impl DocumentQuery {
}
/// Get the underlying file path for the document selected by this query.
pub(crate) fn file_path(&self) -> &PathBuf {
pub(crate) fn file_path(&self) -> &Path {
match self {
Self::Text { file_path, .. } | Self::Notebook { file_path, .. } => file_path,
}

View file

@ -73,10 +73,17 @@ impl RuffSettings {
}
}
/// Return the [`ruff_workspace::FileResolverSettings`] for this [`RuffSettings`].
pub(crate) fn file_resolver(&self) -> &ruff_workspace::FileResolverSettings {
&self.file_resolver
}
/// Return the [`ruff_linter::settings::LinterSettings`] for this [`RuffSettings`].
pub(crate) fn linter(&self) -> &ruff_linter::settings::LinterSettings {
&self.linter
}
/// Return the [`ruff_workspace::FormatterSettings`] for this [`RuffSettings`].
pub(crate) fn formatter(&self) -> &ruff_workspace::FormatterSettings {
&self.formatter
}