-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: fmt config #2173
Comments
I like the idea of having it inside Regarding the options, I think at least |
Agree on CC @transmissions11 @mds1 @lucas-manuel @FrankieIsLost for more opinions on config options. |
these options lgtm rn, tho as i use it more i will probably come up with new ones |
Looking at the above + prettier-plugin-solidity, here is what I think the full list of options can be
What does this look like exactly, i.e. is the |
Good q - how should we be thinking about it @mattsse? I think having a |
Having it directly in a this will cover project specific settings. for global settings, we should do the same for |
A bit offtopic: I've talked a bit about this before but I think we should at least consider moving towards a more structured config format, especially if we at some point want to support different VMs and/or languages. Essentially something a bit more like Cargo where profiles would be e.g. |
we call that a moat sir, jk. we can make
yes - although i think we dont use a global foundry toml anywhere yet?
agreed, I like the idea of adding a |
+1 on namespacing things in the config file like |
personally feel OK with a small breaking change like this, but good reminder for us to start specifying stabilization criteria (milestone probably being fmt/coverage/multichain forking/invariant tests/fuzzer improvements/stable configs?). also OK with a warning, as long as it doesn't introduce a bunch of code churn to detect the old format. |
Imo as we're moving towards a stabler release we have some breaking changes backlogged that we could roll out in "one go" since foundryup would most likely break at the same time after RIIR. Depending on feasibility we could even tag a "pre-stable" version before we cut our first stable that people could use until they get around to migrating depending on how much breakage there is |
wouldn't it be possible to seamlessly replace bash version with the new Rust one after |
On some platforms maybe, but overwriting currently running programs have odd edge cases on some platforms :/ |
You are missing by compiler version, prettier solidity lets you adjust depending on the pragma version. Additionally you can sort imports as well, here us an example:
line-length isn't an option, printWidth is, see the discussion here: prettier-solidity/prettier-plugin-solidity#474 (comment) This option is misleading as its not a count of characters per line (which makes sense as it would break code if it strictly enforced that). Also probably the most requested feature is If you can add maybe something like Would be 💯🚀🍻 |
Ah specifying import sort order would be great 👌 |
|
I wanted to clarify, the foundry.toml changes before I go ahead and implement this. Do we want to still have a |
My current thinking is something like: I think having separate |
I think we should go with that, the alternative seems to be more complicated than we want rn. So let's go with the former @jpopesculian |
If you want, i can also just parse all unknown groups as profiles and output a deprecation warning in order to break as little as possible |
I like this as well, this will free us up to do a |
Would be great to replace non-checksummed addresses with checksummed. |
do we have a linting wishlist, of tracking issue for |
@mattsse not to my knowledge |
cast already has an option for providing a checksummed address.
What is |
Is anyone actively working on this? I would like to help a bit if possible |
@0xGorilla, Julian (@jpopesculian) is tackling this one |
This is in master now, [fmt] can be configed as described at the OP. I don't think we need to track forge fix yet because we don't have/have designed it |
For the record, we are going to remove the |
Oh interesting, can you expand on why? The types don't affect bytecode at all so it feels like a formatting/style choice only. (I'm not sure if this is also true for import order). Checked the PR (prettier-solidity/prettier-plugin-solidity#730) and couldn't find any discussion around the decision/controversy, though I did see it affects the AST but from a user-standpoint they won't notice that which makes it feel like just a style preference |
It's not a black-and-white thing, admittedly. To me, it always felt wrong, and some people have told me they find it a weird thing for prettier-solidity to do. Plus, I'm very much in favor of having as few options in the formatter as possible. The thing that finally convinced me is realizing that prettier-core doesn't re-write |
Component
Forge
Describe the feature you would like
The formatter uses a configuration with hardcoded values. The goal is to define the input format for the configuration (i.e. whether the configuration will be defined in a separate file like
fmt.toml
or it will become a part of foundry config) and, potentially, expand the options.Currently, the supported configuration values are:
line_length
- maximum line length where formatter will try to wrap the linetab_width
- number of spaces per indentation levelbracket_spacing
- print spaces between bracketsAdditional context
No response
The text was updated successfully, but these errors were encountered: