Formatting (indentation, line length, etc.) can be managed in three ways:
- Automatic Resolution: If
ParserConfig.formatConfig is null, the Processor automatically resolves settings from .editorconfig files by walking up from the output directory. - Programmatic Override: Explicitly setting
formatConfig in ParserConfig skips .editorconfig resolution. - CLI Flags: Use flags to override settings during command-line execution.
Supported .editorconfig properties:
| EditorConfig Property | FormatConfig Field |
|---|
indent_size | indentSize (default: 4) |
indent_style | indentStyle (default: SPACE) |
max_line_length | maxLineLength (default: 120) |
insert_final_newline | insertFinalNewline (default: true) |
val config = ParserConfig(
pkg = "com.example",
theme = "MyTheme",
optimize = true,
formatConfig = FormatConfig(
indentSize = 2,
indentStyle = IndentStyle.SPACE,
),
)