pub struct DprintConfig {Show 15 fields
pub schema: Option<String>,
pub incremental: Option<bool>,
pub extends: Option<Extends>,
pub line_width: Option<u32>,
pub indent_width: Option<u32>,
pub use_tabs: Option<bool>,
pub new_line_kind: Option<NewLineKind>,
pub includes: Option<Vec<String>>,
pub excludes: Option<Vec<String>>,
pub plugins: Option<Vec<String>>,
pub typescript: Option<TypeScriptConfig>,
pub json: Option<JsonConfig>,
pub toml: Option<TomlConfig>,
pub markdown: Option<MarkdownConfig>,
pub plugin_configs: BTreeMap<String, PluginConfig>,
}Expand description
dprint configuration file (dprint.json / .dprint.json).
Configuration for the dprint code formatter.
The config file is typically named dprint.json, .dprint.json,
dprint.jsonc, or .dprint.jsonc and placed at the root of your
project.
Global formatting options (lineWidth,
indentWidth,
useTabs,
newLineKind) apply as defaults to all
plugins but can be overridden in per-plugin configuration sections.
Plugin-specific configuration is placed at the top level, keyed by the plugin name:
{
"lineWidth": 80,
"typescript": {
"quoteStyle": "preferSingle"
},
"json": {
"indentWidth": 2
},
"plugins": [
"https://plugins.dprint.dev/typescript-0.93.3.wasm",
"https://plugins.dprint.dev/json-0.19.4.wasm"
]
}Fields§
§schema: Option<String>The JSON schema URL for editor validation and autocompletion.
The dprint VS Code extension automatically constructs a composite schema based on the installed plugins, so you usually don’t need to set this manually.
incremental: Option<bool>Only format files that have changed since the last formatting run.
When true (the default), dprint tracks which files have been
formatted and skips unchanged files on subsequent runs. Set to
false to always reformat all matched files.
Can also be toggled via the --incremental / --incremental=false
CLI flag.
extends: Option<Extends>One or more configuration files to extend.
Can be a single path/URL or an array of paths/URLs. Properties from extended configs are merged, with the current file taking precedence. Earlier entries in an array take priority over later ones.
Supports the ${configDir} variable (resolves to the directory of
the current config file) and ${originConfigDir} (resolves to the
directory of the original/root config file).
When extending remote configs (URLs), includes and non-Wasm
plugins entries are ignored for security.
line_width: Option<u32>The maximum line width the formatter tries to stay under.
The formatter may exceed this width in certain cases where breaking the line would produce worse output. This is a global default that individual plugins can override in their configuration sections.
indent_width: Option<u32>The number of characters for each indent level.
When useTabs is true, this controls the visual width of each
tab character. When useTabs is false, this is the number of
spaces inserted per indent level. This is a global default that
individual plugins can override in their configuration sections.
use_tabs: Option<bool>Whether to use tabs (true) or spaces (false) for indentation.
This is a global default that individual plugins can override in their configuration sections.
new_line_kind: Option<NewLineKind>The newline character style to use when formatting.
This is a global default that individual plugins can override in their configuration sections.
includes: Option<Vec<String>>Glob patterns for files to include in formatting.
When specified, only files matching at least one of these patterns
are formatted. When omitted, all files matched by installed plugins
are formatted (respecting excludes).
Uses gitignore-style glob syntax.
excludes: Option<Vec<String>>Glob patterns for files or directories to exclude from formatting.
Uses gitignore-style glob syntax. Files already ignored by
.gitignore are excluded automatically. Prefix a pattern with !
to un-exclude files that were previously excluded.
plugins: Option<Vec<String>>Plugin URLs or local file paths.
Each entry is a URL to a WebAssembly plugin (.wasm) or a local
file path. The order determines precedence when multiple plugins
can handle the same file extension — the first matching plugin
wins.
Can also be specified via the --plugins CLI flag.
typescript: Option<TypeScriptConfig>TypeScript / JavaScript plugin configuration.
json: Option<JsonConfig>JSON plugin configuration.
toml: Option<TomlConfig>TOML plugin configuration.
markdown: Option<MarkdownConfig>Markdown plugin configuration.
plugin_configs: BTreeMap<String, PluginConfig>Configuration for plugins not covered by the typed fields above.
Trait Implementations§
Source§impl Clone for DprintConfig
impl Clone for DprintConfig
Source§fn clone(&self) -> DprintConfig
fn clone(&self) -> DprintConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DprintConfig
impl Debug for DprintConfig
Source§impl<'de> Deserialize<'de> for DprintConfig
impl<'de> Deserialize<'de> for DprintConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for DprintConfig
impl JsonSchema for DprintConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more