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 sort_requires: SortRequiresConfig,
pub space_after_function_names: SpaceAfterFunctionNames,
}
Expand description
The configuration to use when formatting.
Fields§
§syntax: LuaVersion
The type of Lua syntax to parse.
column_width: usize
The 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: LineEndings
The type of line endings to use.
indent_type: IndentType
The type of indents to use.
indent_width: usize
The 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: QuoteStyle
The style of quotes to use in string literals.
no_call_parentheses: bool
call_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: CallParenType
When 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: CollapseSimpleStatement
Whether 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: SortRequiresConfig
Configuration for the sort requires codemod
space_after_function_names: SpaceAfterFunctionNames
Whether we should include a space between the function name and arguments.
- if space_after_function_names is set to
SpaceAfterFunctionNames::Never
a space is never used. - if space_after_function_names is set to
SpaceAfterFunctionNames::Definitions
a space is used only for definitions. - if space_after_function_names is set to
SpaceAfterFunctionNames::Calls
a space is used only for calls. - if space_after_function_names is set to
SpaceAfterFunctionNames::Always
a space is used for both definitions and calls.