Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
finxxi committed Oct 8, 2024
1 parent a72c37d commit f281737
Show file tree
Hide file tree
Showing 3 changed files with 14,094 additions and 406 deletions.
75 changes: 66 additions & 9 deletions doc/Settings.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,66 @@
# Configuring Afmt

- max_width: Maximum width of each line
- brace_style
- tab_space
- hard_tabs
- use_small_heuristics
- fn_params_layout
- Function arguments (Block v.s. Visual)
# Configurations to take into consideration

## `max_width`

Maximum width of each line

- **Default value**: `100`
- **Possible values**: any positive integer
- **Stable**: Yes

## `fn_params_layout`

It affects the layout of parameters in function signatures.

- **Default value**: `"Tall"`
- **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
- **Stable**: No (tracking issue: [#1]()

## `fn_call_width`

Maximum width of the args of a function call before falling back to vertical formatting.

- **Default value**: `60`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: No

## `indent_style`

Indent on expressions or items.

- **Default value**: `"Block"`
- **Possible values**: `"Block"`, `"Visual"`
- **Stable**: No

## `short_array_element_width_threshold`

The width threshold for an array element to be considered "short".

The layout of an array is dependent on the length of each of its elements.
If the length of every element in an array is below this threshold (all elements are "short") then the array can be formatted in the mixed/compressed style, but if any one element has a length that exceeds this threshold then the array elements will have to be formatted vertically.

- **Default value**: `10`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: No

## `use_small_heuristics`

This option can be used to simplify the management and bulk updates of the granular width configuration settings ([`fn_call_width`](#fn_call_width), [`attr_fn_like_width`](#attr_fn_like_width), [`struct_lit_width`](#struct_lit_width), [`struct_variant_width`](#struct_variant_width), [`array_width`](#array_width), [`chain_width`](#chain_width), [`single_line_if_else_max_width`](#single_line_if_else_max_width)), that respectively control when formatted constructs are multi-lined/vertical based on width.

Note that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.

- **Default value**: `"Default"`
- **Possible values**: `"Default"`, `"Off"`, `"Max"`
- **Stable**: Yes

## `wrap_comments`

Break comments to fit on the line

Note that no wrapping will happen if:
1. The comment is the start of a markdown header doc comment
2. An URL was found in the comment

- **Default value**: `false`
- **Possible values**: `true`, `false`
- **Stable**: No
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
format_macro_matchers = true
Loading

0 comments on commit f281737

Please sign in to comment.