1

I'm using Foundry toolchain and vscode for my smart contracts development. As suggested by the Foundry documentation I applied the vscode integration tweaks and I'm using forge formatter to format my code, here is the relevant part from my vscode settings file:

"[solidity]": {
    "editor.defaultFormatter": "JuanBlanco.solidity"
},
"solidity.formatter": "forge",

It works well, but now I would like to customize the formatter (there are many options for configuration). How can I apply the forge formatting configuration to my vscode?

1
  • 2
    You can't customize the formatter in VSCode. You need to do it in a Foundry config file. See how I do it in my Foundry template. Oct 24, 2023 at 12:06

1 Answer 1

1

It worked by adding the configuration block to my foundry.toml file.

[fmt] # See https://book.getfoundry.sh/reference/config/formatter
int_types = "short"
line_length = 120
bracket_spacing = true
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "single"
ignore = ['./script/**/*']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.