Skip to content

TOML

The TOML language configuration. It is used to define the settings and options for the TOML formatter.

tool

The tool to use for formatting the TOML files. Currently, only taplo is supported.

  • Type: "taplo"
  • Default: "taplo"

Example:

toml
[formatter]
tool = "taplo"

indent_style

The style of indentation. It can be set to tab or space to use hard tabs or soft tabs respectively.

  • Type: "space" | "tab"
  • Default: "tab"

Example:

toml
[formatter.toml]
indent_style = "space"

indent_width

The number of columns used for each indentation level.

  • Type: int
  • Default: 2

Example:

toml
[formatter.toml]
indent_width = 4

end_of_line

The character used to represent the end of a line. It can be set to lf or crlf to use line feed ("\n") or carriage return line feed ("\r\n") respectively.

  • Type: "lf" | "crlf"
  • Default: "lf"

Example:

toml
[formatter.toml]
end_of_line = "crlf"

trim_trailing_whitespace

Flag if any whitespace characters preceding newline characters should be removed.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml]
trim_trailing_whitespace = false

insert_final_newline

Flags if a newline character should be inserted at the end of the file.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml]
insert_final_newline = false

line_width

The maximum number of columns used before wrapping lines.

  • Type: int
  • Default: 80

Example:

toml
[formatter.toml]
line_width = 120

taplo

The configuration options for the taplo formatter.


align_entries

Align entries vertically. Entries that have table headers, comments, or blank lines between them are not aligned.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
align_entries = true

align_comments

Align consecutive comments after entries and items vertically. This applies to comments that are after entries or array items.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
align_comments = false

align_single_comments

If align_comments is true, apply the alignment in cases where there's only one comment.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
align_single_comments = false

array_trailing_comma

Put trailing commas for multiline arrays.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
array_trailing_comma = false

array_auto_expand

Automatically expand arrays to multiple lines if they're too long.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
array_auto_expand = false

inline_table_expand

Expand values (e.g.) inside inline tables where possible.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
inline_table_expand = false

array_auto_collapse

Automatically collapse arrays if they fit in one line. The array won't be collapsed if it contains a comment.

  • Type: boolean
  • Default: true

Example:

toml
[formatter.toml.taplo]
array_auto_collapse = false

compact_arrays

Omit whitespace padding inside single-line arrays.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
compact_arrays = true

compact_inline_tables

Omit whitespace padding inside inline tables.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
compact_inline_tables = true

compact_entries

Omit whitespace around =.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
compact_entries = true

indent_tables

Indent subtables if they come in order.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
indent_tables = true

indent_entries

Indent entries under tables.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
indent_entries = true

reorder_keys

Alphabetically reorder keys that are not separated by blank lines.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
reorder_keys = true

reorder_arrays

Alphabetically reorder array values that are not separated by blank lines.

  • Type: boolean
  • Default: false

Example:

toml
[formatter.toml.taplo]
reorder_arrays = true

allowed_blank_lines

The maximum amount of consecutive blank lines allowed.

  • Type: int
  • Default: 2

Example:

toml
[formatter.toml.taplo]
allowed_blank_lines = 1