mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-14 07:38:21 +00:00
Introduce FormatterSettings
(#7545)
This commit is contained in:
parent
87a0cd219f
commit
f8f1cd5016
16 changed files with 159 additions and 75 deletions
|
@ -1,9 +1,12 @@
|
|||
use ruff_formatter::printer::{LineEnding, PrinterOptions, SourceMapGeneration};
|
||||
use ruff_formatter::{FormatOptions, IndentStyle, IndentWidth, LineWidth};
|
||||
use ruff_macros::CacheKey;
|
||||
use ruff_python_ast::PySourceType;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
/// Resolved options for formatting one individual file. This is different from [`crate::FormatterSettings`] which
|
||||
/// represents the formatting settings for multiple files (the whole project, a subdirectory, ...)
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
|
@ -176,7 +179,7 @@ impl FormatOptions for PyFormatOptions {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, CacheKey)]
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
derive(serde::Serialize, serde::Deserialize),
|
||||
|
@ -230,7 +233,7 @@ impl FromStr for QuoteStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
#[derive(Copy, Clone, Debug, Default, CacheKey)]
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
derive(serde::Serialize, serde::Deserialize),
|
||||
|
@ -261,7 +264,7 @@ impl FromStr for MagicTrailingComma {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default, CacheKey)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
|
||||
pub enum PreviewMode {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue