Crates.io | swayfmt |
lib.rs | swayfmt |
version | 0.61.2 |
source | src |
created_at | 2022-09-03 00:57:10.65306 |
updated_at | 2024-07-03 22:49:48.475826 |
description | Sway language formatter. |
homepage | https://fuel.network/ |
repository | https://github.com/FuelLabs/sway |
max_upload_size | |
id | 657675 |
size | 440,923 |
A tool for formatting Sway code according to style guidelines.
swayfmt
, install the forc-fmt plugin using fuelup.swayfmt
, see CONTRIBUTING.swayfmt.toml
Swayfmt is meant to be configurable, however currently it only supports the default configuration options.
Note: Not all
Config
options are guaranteed to work and most are not implemented. Configuration options are subject to change between versions without notice. If you would like to see a feature implemented, or implement a feature please refer to the CONTRIBUTING guide.
The default swayfmt.toml
:
max_width = 100
hard_tabs = false
tab_spaces = 4
newline_style = Auto
indent_style = Block
newline_threshold = 1
group_imports = Preserve
imports_granularity = Preserve
imports_indent = Block
reorder_imports = true
reorder_modules = true
reorder_impl_items = false
item_brace_style = SameLineWhere
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
empty_item_single_line = true
format_strings = false
hex_literal_case = Preserve
expr_brace_style = AlwaysSameLine
trailing_semicolon = true
space_before_colon = false
space_after_colon = false
type_combinator_layout = Wide
spaces_around_ranges = false
match_block_trailing_comma = false
match_arm_leading_pipe = Never
force_multiline_blocks = false
fn_args_layout = Tall
fn_single_line = false
heuristics_pref = Scaled
use_small_heuristics = true
field_alignment = Off
small_structures_single_line = true
wrap_comments = false
comment_width = 80
normalize_comments = false