It looks like you can add a swayfmt.toml
file to your project to configure the formatter, and there is even an example of such file in the sway repo.
I tried to add this file with the default configuration to the root of my project, next to Forc.toml
, but running forc fmt
fails with an error:
error: failed to parse config: TOML parse error at line 4, column 17
Fixing the toml issues by wrapping string into quotes like:
newline_style = 'Auto'
doesn’t help much. After that, the formatter emits a bunch of warnings about unusable configurations, eg:
WARNING! found unusable configuration: max_width
Is there a proper example on how to use the swayfmt file?
$ forc fmt --version
forc-fmt 0.61.2
1 Like
hey @mpoplavkov, can you please share the codebase that you are trying to format? I had an src20 contract and added the swayfmt.toml
with the default config and it didn’t throw me any error
In the default config even the toml syntax is violated
I just cloned the Sway applications repo and tested the config on one of the projects inside it - airdrop
.
If I do just:
cd airdrop
forc fmt
Everything works.
But, if I add the swayfmt.toml
file, I have the errors I described in the topic above:
cd airdrop
vim swayfmt.toml # fill it with default configuration
forc fmt
Thanks, @mpoplavkov, was able to reproduce the error. Will share it with the team and will keep you posted
1 Like
Hey @mpoplavkov, we have revoked support for the configuration but we hadn’t updated the docs. You can look at here for the updated docs.
Hey, I see that the standard configuration was just removed from the docs in the link you shared. Am I missing something? Or there will be no way to configure swayfmt at all for now?
Yes, its support has been revoked
Are there any alternative solutions? The way swayfmt works with standard config is not acceptable sometimes I’d say.
hey, totally missed this.
Can you please tell me what you are looking for? i will share the updated resources