pub struct Config {
pub syntax: LuaVersion,
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 block_newline_gaps: BlockNewlineGaps,
pub sort_requires: SortRequiresConfig,
pub space_after_function_names: SpaceAfterFunctionNames,
}Expand description
The configuration to use when formatting.
Fields§
§syntax: LuaVersionThe type of Lua syntax to parse.
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
block_newline_gaps: BlockNewlineGapsWhether we should allow blocks to preserve leading and trailing newline gaps.
if set to BlockNewlineGaps::Never then newline gaps are never allowed at the start or end of blocks.
if set to BlockNewlineGaps::Preserve then newline gaps are preserved at the start and end of blocks.
sort_requires: SortRequiresConfigConfiguration for the sort requires codemod
space_after_function_names: SpaceAfterFunctionNamesWhether we should include a space between the function name and arguments.
- if space_after_function_names is set to
SpaceAfterFunctionNames::Nevera space is never used. - if space_after_function_names is set to
SpaceAfterFunctionNames::Definitionsa space is used only for definitions. - if space_after_function_names is set to
SpaceAfterFunctionNames::Callsa space is used only for calls. - if space_after_function_names is set to
SpaceAfterFunctionNames::Alwaysa space is used for both definitions and calls.