Struct stylua_lib::Config
source · pub struct Config {
pub column_width: usize,
pub line_endings: LineEndings,
pub indent_type: IndentType,
pub indent_width: usize,
pub quote_style: QuoteStyle,
pub no_call_parentheses: bool,
pub call_parentheses: CallParenType,
pub collapse_simple_statement: CollapseSimpleStatement,
pub sort_requires: SortRequiresConfig,
}Expand description
The configuration to use when formatting.
Fields§
§column_width: usizeThe approximate line length to use when printing the code. This is used as a guide to determine when to wrap lines, but note that this is not a hard upper bound.
line_endings: LineEndingsThe type of line endings to use.
indent_type: IndentTypeThe type of indents to use.
indent_width: usizeThe width of a single indentation level.
If indent_type is set to IndentType::Spaces, then this is the number of spaces to use.
If indent_type is set to IndentType::Tabs, then this is used as a heuristic to guide when to wrap lines.
quote_style: QuoteStyleThe style of quotes to use in string literals.
no_call_parentheses: boolcall_parentheses insteadWhether to omit parentheses around function calls which take a single string literal or table. This is added for adoption reasons only, and is not recommended for new work.
call_parentheses: CallParenTypeWhen to use call parentheses.
if call_parentheses is set to CallParenType::Always call parentheses is always applied.
if call_parentheses is set to CallParenType::NoSingleTable call parentheses is omitted when
function is called with only one string argument.
if call_parentheses is set to CallParenType::NoSingleTable call parentheses is omitted when
function is called with only one table argument.
if call_parentheses is set to CallParenType::None call parentheses is omitted when
function is called with only one table or string argument (same as no_call_parentheses).
collapse_simple_statement: CollapseSimpleStatementWhether we should collapse simple structures like functions or guard statements
if set to [CollapseSimpleStatement::None] structures are never collapsed.
if set to CollapseSimpleStatement::FunctionOnly then simple functions (i.e., functions with a single laststmt) can be collapsed
sort_requires: SortRequiresConfigConfiguration for the sort requires codemod
Implementations§
source§impl Config
impl Config
sourcepub fn column_width(&self) -> usize
👎Deprecated since 0.19.0: access .column_width directly instead
pub fn column_width(&self) -> usize
.column_width directly insteadReturns the current configured column width
sourcepub fn line_endings(&self) -> LineEndings
👎Deprecated since 0.19.0: access .line_endings directly instead
pub fn line_endings(&self) -> LineEndings
.line_endings directly insteadReturns the current configured line endings
sourcepub fn indent_type(&self) -> IndentType
👎Deprecated since 0.19.0: access .indent_type directly instead
pub fn indent_type(&self) -> IndentType
.indent_type directly insteadReturns the current configured indent type
sourcepub fn indent_width(&self) -> usize
👎Deprecated since 0.19.0: access .indent_width directly instead
pub fn indent_width(&self) -> usize
.indent_width directly insteadReturns the current configured indent width
sourcepub fn quote_style(&self) -> QuoteStyle
👎Deprecated since 0.19.0: access .quote_style directly instead
pub fn quote_style(&self) -> QuoteStyle
.quote_style directly insteadReturns the current configured quote style
sourcepub fn call_parentheses(&self) -> CallParenType
👎Deprecated since 0.19.0: access .call_parentheses directly instead
pub fn call_parentheses(&self) -> CallParenType
.call_parentheses directly insteadReturns the current configured call parentheses style
pub fn collapse_simple_statement(&self) -> CollapseSimpleStatement
.collapse_simple_statement directly insteadsourcepub fn sort_requires(&self) -> SortRequiresConfig
👎Deprecated since 0.19.0: access .sort_requires directly instead
pub fn sort_requires(&self) -> SortRequiresConfig
.sort_requires directly insteadReturns the current sort requires codemod configuration
sourcepub fn with_column_width(self, column_width: usize) -> Self
👎Deprecated since 0.19.0: modify .column_width directly instead
pub fn with_column_width(self, column_width: usize) -> Self
.column_width directly insteadReturns a new config with the given column width
sourcepub fn with_line_endings(self, line_endings: LineEndings) -> Self
👎Deprecated since 0.19.0: modify .line_endings directly instead
pub fn with_line_endings(self, line_endings: LineEndings) -> Self
.line_endings directly insteadReturns a new config with the given line endings
sourcepub fn with_indent_type(self, indent_type: IndentType) -> Self
👎Deprecated since 0.19.0: modify .indent_type directly instead
pub fn with_indent_type(self, indent_type: IndentType) -> Self
.indent_type directly insteadReturns a new config with the given indent type
sourcepub fn with_indent_width(self, indent_width: usize) -> Self
👎Deprecated since 0.19.0: modify .indent_width directly instead
pub fn with_indent_width(self, indent_width: usize) -> Self
.indent_width directly insteadReturns a new config with the given indent width
sourcepub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
👎Deprecated since 0.19.0: modify .quote_style directly instead
pub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
.quote_style directly insteadReturns a new config with the given quote style
sourcepub fn with_no_call_parentheses(self, no_call_parentheses: bool) -> Self
👎Deprecated: use `call_parentheses
pub fn with_no_call_parentheses(self, no_call_parentheses: bool) -> Self
Returns a new config with the given value for no_call_parentheses
sourcepub fn with_call_parentheses(self, call_parentheses: CallParenType) -> Self
👎Deprecated since 0.19.0: modify .call_parentheses directly instead
pub fn with_call_parentheses(self, call_parentheses: CallParenType) -> Self
.call_parentheses directly insteadReturns a new config with the given call parentheses type
pub fn with_collapse_simple_statement( self, collapse_simple_statement: CollapseSimpleStatement ) -> Self
.collapse_simple_statement directly insteadsourcepub fn with_sort_requires(self, sort_requires: SortRequiresConfig) -> Self
👎Deprecated since 0.19.0: modify .sort_requires directly instead
pub fn with_sort_requires(self, sort_requires: SortRequiresConfig) -> Self
.sort_requires directly insteadReturns a new config with the given sort requires configuration