mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:25:17 +00:00
Add Jupyter Notebook document change snapshot test (#11944)
## Summary Closes #11914. This PR introduces a snapshot test that replays the LSP requests made during a document formatting request, and confirms that the notebook document is updated in the expected way.
This commit is contained in:
parent
927069c12f
commit
3ab7a8da73
13 changed files with 921 additions and 20 deletions
|
@ -49,7 +49,7 @@ enum DocumentController {
|
|||
/// This query can 'select' a text document, full notebook, or a specific notebook cell.
|
||||
/// It also includes document settings.
|
||||
#[derive(Clone)]
|
||||
pub(crate) enum DocumentQuery {
|
||||
pub enum DocumentQuery {
|
||||
Text {
|
||||
file_url: Url,
|
||||
document: Arc<TextDocument>,
|
||||
|
@ -519,7 +519,7 @@ impl DocumentQuery {
|
|||
}
|
||||
|
||||
/// Attempts to access the underlying notebook document that this query is selecting.
|
||||
pub(crate) fn as_notebook(&self) -> Option<&NotebookDocument> {
|
||||
pub fn as_notebook(&self) -> Option<&NotebookDocument> {
|
||||
match self {
|
||||
Self::Notebook { notebook, .. } => Some(notebook),
|
||||
Self::Text { .. } => None,
|
||||
|
|
|
@ -18,7 +18,7 @@ use walkdir::WalkDir;
|
|||
|
||||
use crate::session::settings::{ConfigurationPreference, ResolvedEditorSettings};
|
||||
|
||||
pub(crate) struct RuffSettings {
|
||||
pub struct RuffSettings {
|
||||
/// The path to this configuration file, used for debugging.
|
||||
/// The default fallback configuration does not have a file path.
|
||||
path: Option<PathBuf>,
|
||||
|
|
|
@ -60,7 +60,7 @@ pub(crate) enum ConfigurationPreference {
|
|||
#[derive(Debug, Deserialize, Default)]
|
||||
#[cfg_attr(test, derive(PartialEq, Eq))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub(crate) struct ClientSettings {
|
||||
pub struct ClientSettings {
|
||||
configuration: Option<String>,
|
||||
fix_all: Option<bool>,
|
||||
organize_imports: Option<bool>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue