Skip to content
Merged
Show file tree
Hide file tree
Changes from 162 commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
98fc4a2
init
DaniPopes Apr 9, 2025
4fe995e
wip
DaniPopes Apr 14, 2025
8face95
wip
DaniPopes Apr 14, 2025
4e7abc1
add dbg from prettyplease
DaniPopes Apr 14, 2025
350332a
wip
DaniPopes Apr 15, 2025
4b54bf9
fixes, pragma&imports
DaniPopes Apr 15, 2025
7ed556b
feat: using, types, literals
DaniPopes Apr 16, 2025
b99ee19
feat: contract
DaniPopes Apr 16, 2025
5e21a4c
rm duplicate testdata
DaniPopes Apr 16, 2025
8dc7b98
wip: finish items; exprs, stmts
DaniPopes Apr 16, 2025
a6e1930
wips
DaniPopes Apr 17, 2025
c4706a8
feat: line_length, tab_width
DaniPopes Apr 17, 2025
fb15641
feat: contract_new_lines
DaniPopes Apr 17, 2025
e03b056
wip: single_line_statement_blocks
DaniPopes Apr 17, 2025
edcc467
tweaks
DaniPopes Apr 18, 2025
2878e87
chore: bump solar to latest main
DaniPopes Apr 19, 2025
ffe3b65
fix: test dir
DaniPopes Apr 19, 2025
b55e0e7
Merge branch 'master' into dani/fmt-solar
DaniPopes Apr 22, 2025
9762203
bump
DaniPopes Apr 22, 2025
ff3b76b
fix docs
DaniPopes Apr 22, 2025
e4e069e
fix: adjust '()' for modifier calls
DaniPopes Apr 22, 2025
3e0ece8
test: typed yul does not exist anymore
DaniPopes Apr 22, 2025
872da09
test: function parameters cannot be empty
DaniPopes Apr 22, 2025
b38a820
fix: adjust '()' for modifier calls for real
DaniPopes Apr 22, 2025
2f7400b
fix: forge fmt hates '*' imports
DaniPopes Apr 22, 2025
967b026
test: fix some invalid syntax
DaniPopes Apr 22, 2025
100f8e0
test: disable-stop does not exist
DaniPopes Apr 22, 2025
6c53373
test: fix all parse errors
DaniPopes Apr 22, 2025
da745a7
fix: literal touchups
DaniPopes Apr 23, 2025
22741de
bump
DaniPopes Apr 23, 2025
357d6ab
Merge branch 'master' into dani/fmt-solar
DaniPopes Apr 28, 2025
7b8b919
test: add snapshotting
DaniPopes Apr 28, 2025
19a5402
test: update NumberLiteralUnderscore
DaniPopes Apr 28, 2025
3558807
fixes
DaniPopes Apr 28, 2025
6b45260
struct space
DaniPopes Apr 28, 2025
1858c04
test: fix StructDefinition; empty structs are not allowed anyway
DaniPopes Apr 28, 2025
79bc94c
test: update EventDefinition; matches Solidity style guide
DaniPopes Apr 28, 2025
d00bc3f
test: update EnumDefinition; same as StructDefinition
DaniPopes Apr 28, 2025
2979b00
test: update StructDefinition 2
DaniPopes Apr 28, 2025
4f287e7
fix: comments in structs/enums
DaniPopes Apr 28, 2025
dc47584
test: update ErrorDefinition; matches Solidity style guide
DaniPopes Apr 28, 2025
cf5e826
feat: print docs with other comments; update EnumVariants
DaniPopes Apr 28, 2025
91b608a
chore: update EnumDefinition, StructDefinition
DaniPopes Apr 28, 2025
15bbbf2
chore: readd post_break
DaniPopes Apr 28, 2025
d331896
chore: rename is_hardbreak_tok
DaniPopes Apr 28, 2025
ccf4da9
Merge branch 'master' into dani/fmt-solar
DaniPopes Apr 30, 2025
2ed2a07
feat: cleanups, more impls
DaniPopes Apr 30, 2025
8b350b9
test: fix some compile errors
DaniPopes Apr 30, 2025
7009742
feat: add FormatterResult with more variants
DaniPopes May 1, 2025
ecef2bd
stuff
DaniPopes May 2, 2025
1788a63
refactor: move print_item arms into their own functions
DaniPopes May 2, 2025
4a5ff36
chore: consolidate item hardbreaks
DaniPopes May 2, 2025
adba140
Merge branch 'master' into dani/fmt-solar
DaniPopes May 5, 2025
b9f2cbe
fix: inline config parsing for block comments
DaniPopes May 5, 2025
bc4093c
wip: rm FunctionLike, wip functions
DaniPopes May 5, 2025
d6ff628
fix: clamp margin to max as well
DaniPopes May 5, 2025
1a827c5
megawip
DaniPopes May 8, 2025
1b2a400
feat: most of yul
DaniPopes May 13, 2025
88d32ec
wip: try-catch
0xrusowsky Jun 18, 2025
aa1a0a5
wip: try-catch
0xrusowsky Jun 18, 2025
e945d91
feat: print compact tuple
0xrusowsky Jun 18, 2025
0189490
wip: inline comments
0xrusowsky Jun 18, 2025
3bde150
wip: try-cactch
0xrusowsky Jun 19, 2025
bc59dc5
bump solar to have try-catch spans (#10832)
0xrusowsky Jun 22, 2025
6f86df2
wip comment fmt
0xrusowsky Jun 23, 2025
43e1fc2
wip: array expr
0xrusowsky Jun 23, 2025
9694fa1
finish arrays
0xrusowsky Jun 23, 2025
2322863
block comments
0xrusowsky Jun 23, 2025
e174b3c
doc block comments
0xrusowsky Jun 23, 2025
20d91e2
ternary operators
0xrusowsky Jun 24, 2025
361db14
wip: fn header
0xrusowsky Jun 27, 2025
e2a4055
wip: fn header
0xrusowsky Jun 27, 2025
38f6f7c
fix: doc block comments + block braces
0xrusowsky Jul 1, 2025
6d178bb
refactor state to organize helpers
0xrusowsky Jul 2, 2025
66f9c6c
fix commasep with initial trailing cmnt
0xrusowsky Jul 2, 2025
7ba3c5f
fix: improve contract fmt
0xrusowsky Jul 3, 2025
729e250
fix: block comments + contract definition
0xrusowsky Jul 3, 2025
3c518a1
fix: wrap trailing comments
0xrusowsky Jul 3, 2025
d4c9403
fix fn alingment
0xrusowsky Jul 3, 2025
b06a67b
fix: rmv unecessary check
0xrusowsky Jul 3, 2025
c156ebf
working fn headers!!!
0xrusowsky Jul 4, 2025
a6afa14
block with comments at the beginning
0xrusowsky Jul 4, 2025
16aa884
bump solar
0xrusowsky Jul 6, 2025
a7382ef
inline if statements based on user config
0xrusowsky Jul 11, 2025
3162a89
operator expr
0xrusowsky Jul 13, 2025
5c2e8d6
finish binary operators + housekeeping
0xrusowsky Jul 14, 2025
3105192
housekeeping
0xrusowsky Jul 14, 2025
09dc9ff
feat: binary expressions
0xrusowsky Jul 15, 2025
57aff04
fix: string literals
0xrusowsky Jul 15, 2025
3b0a10f
refactor comments + finish mappings
0xrusowsky Jul 16, 2025
81d1867
named functions
0xrusowsky Jul 16, 2025
c617d1b
item spacing
0xrusowsky Jul 17, 2025
fc5ae7f
more flexible comments + return stmts
0xrusowsky Jul 17, 2025
0af1bd6
var definition and flexible comments (#11093)
0xrusowsky Jul 24, 2025
16a0a81
comment wrapping
0xrusowsky Jul 26, 2025
e394ae3
sorted imports
0xrusowsky Jul 27, 2025
7cb9f70
middle cmnts for arrays and literals with subdenominations
0xrusowsky Jul 29, 2025
a499df4
revert: solar won't have spanned dataloc + subdenom
0xrusowsky Jul 30, 2025
f063eeb
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Jul 30, 2025
ca5e843
refactor inline config + almost finished impl
0xrusowsky Aug 1, 2025
9338a6c
finish inline disable
0xrusowsky Aug 2, 2025
2799c32
finish inline disable
0xrusowsky Aug 3, 2025
e79dce8
wip inline disable for repros
0xrusowsky Aug 5, 2025
3c9235b
passing repros
0xrusowsky Aug 5, 2025
5507414
almost working yul
0xrusowsky Aug 5, 2025
39d25d7
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Aug 6, 2025
b474d7a
chore: remove unrelated changes / merge artifacts
DaniPopes Aug 6, 2025
80af920
chore: remove unrelated changes / merge artifacts 2
DaniPopes Aug 6, 2025
b67cc70
chore: remove unrelated changes / merge artifacts 3
DaniPopes Aug 6, 2025
15e293f
update fmt files to reflect current status
0xrusowsky Aug 13, 2025
280cd00
Merge branch 'rusowsky/fmt-solar' of github.com:foundry-rs/foundry in…
0xrusowsky Aug 13, 2025
f07f11a
enable both passes
0xrusowsky Aug 13, 2025
05ed268
undo repros changes
0xrusowsky Aug 13, 2025
fa514c9
config: style = tabs
0xrusowsky Aug 14, 2025
da4fdfc
test: inline config
0xrusowsky Aug 17, 2025
1e6c4ff
style: drop "lint" references in favor of "ids"
0xrusowsky Aug 17, 2025
455d78e
function header config
0xrusowsky Aug 19, 2025
a838ea7
finish fn header config!
0xrusowsky Aug 19, 2025
6e3a73e
re-enable 2nd pass
0xrusowsky Aug 19, 2025
5f9ba3d
finish fn header style
0xrusowsky Aug 19, 2025
2d0b717
feat: yul
0xrusowsky Aug 20, 2025
c4db5ca
test: update tracking cmnts
0xrusowsky Aug 20, 2025
4eb856a
fix: yul repros
0xrusowsky Aug 20, 2025
9660b4d
chore: small comment
DaniPopes Aug 21, 2025
3eaf1ac
chore: random + typos
DaniPopes Aug 21, 2025
110651c
chore: rm dead code
DaniPopes Aug 21, 2025
aa991e6
chore: rm unused vars
DaniPopes Aug 21, 2025
e73664f
chore: clippy --fix
DaniPopes Aug 21, 2025
c5e181f
chore: some manual clippying
DaniPopes Aug 21, 2025
20effb8
Merge branch 'master' into rusowsky/fmt-solar
DaniPopes Aug 21, 2025
0a93f3a
chore: final clippy --fix
DaniPopes Aug 21, 2025
57b91f8
refactor: tidy up
0xrusowsky Aug 29, 2025
7c7acaa
yul: inline blocks
0xrusowsky Aug 29, 2025
70a4934
yul: inline fn params
0xrusowsky Aug 29, 2025
95ed012
ensure all tests are successful
0xrusowsky Aug 29, 2025
1bdd62f
chore(fmt): merge new compiler setup (#11487)
0xrusowsky Aug 30, 2025
75f10f3
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Aug 30, 2025
20d7afc
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Aug 30, 2025
99b429d
patch/impl/test pending repros
0xrusowsky Sep 2, 2025
6098197
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 2, 2025
a025e83
style: typos
0xrusowsky Sep 2, 2025
81dc7b9
docs: update readme
0xrusowsky Sep 2, 2025
d3fce5b
docs: readme feedback
0xrusowsky Sep 4, 2025
ec5d138
Merge branch 'master' of github.com:foundry-rs/foundry into rusowsky/…
0xrusowsky Sep 4, 2025
98a58d7
style: clippy
0xrusowsky Sep 4, 2025
66706dc
fix: merge conflicts
0xrusowsky Sep 4, 2025
f9380a9
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 4, 2025
ffa54db
fix: disable legacy fmt tests
0xrusowsky Sep 4, 2025
e3e64bf
fix: config test
0xrusowsky Sep 4, 2025
22e974e
fix(win): normalize breaks
0xrusowsky Sep 4, 2025
e7fdb96
style: clippy
0xrusowsky Sep 4, 2025
21b8ed6
fix(win): normalize escaped quotes
0xrusowsky Sep 5, 2025
7671801
fix(win): normalize multiline strings
0xrusowsky Sep 5, 2025
b9de877
fix(win): only normalize line breaks for expected data
0xrusowsky Sep 5, 2025
fd64e57
chore: solar-powered fmt rollout (#11570)
0xrusowsky Sep 10, 2025
5c39fdd
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 10, 2025
d20c384
fix: comment spans for asm + try blocks
0xrusowsky Sep 10, 2025
14cfbb1
fix: don't fmt yul addresses
0xrusowsky Sep 10, 2025
f6768b4
fix: empty buffer due to really long comment
0xrusowsky Sep 10, 2025
070c747
add repro
DaniPopes Sep 10, 2025
d97e4c1
Revert "fix: empty buffer due to really long comment"
DaniPopes Sep 10, 2025
9d4b5fd
fix: advance cursor correctly in print_comment
DaniPopes Sep 10, 2025
a2d4af2
fix: bin op indentation in complex exprs
0xrusowsky Sep 10, 2025
9fa58fc
docs
0xrusowsky Sep 10, 2025
319f1d9
chore: clean up
DaniPopes Sep 10, 2025
474a7c3
refactor: inline config
DaniPopes Sep 10, 2025
96e724f
chore: share inline config
DaniPopes Sep 10, 2025
2cae642
Merge branch 'master' into rusowsky/fmt-solar
DaniPopes Sep 10, 2025
4b2a7aa
feat: remove HIR inline config visitor
DaniPopes Sep 10, 2025
f7cc3bf
test: bless
DaniPopes Sep 10, 2025
f2b930c
Merge branch 'rusowsky/fmt-solar' of github.com:foundry-rs/foundry in…
0xrusowsky Sep 10, 2025
59eb02f
style: clippy
0xrusowsky Sep 10, 2025
a705aea
Merge branch 'master' into rusowsky/fmt-solar
DaniPopes Sep 11, 2025
8588e76
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 15, 2025
3d7a761
feat(fmt): call chain awareness (#11611)
0xrusowsky Sep 16, 2025
170b2dc
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 16, 2025
b230420
wip: better call chains + return stmts + more tests
0xrusowsky Sep 16, 2025
1837adb
fix: more yul cmnts
0xrusowsky Sep 16, 2025
275286d
fix: modifier cmnts + more yul cmnts
0xrusowsky Sep 17, 2025
b7e957b
fix: returns with bin ops
0xrusowsky Sep 17, 2025
5090868
fix breaks, still pending indentation
0xrusowsky Sep 17, 2025
1a63bd6
wip: call cahins and nested... getting closer
0xrusowsky Sep 18, 2025
dd4abe6
call stack to fmt complex calls
0xrusowsky Sep 19, 2025
b7e4b59
Merge branch 'master' into rusowsky/fmt-solar
grandizzy Sep 19, 2025
ab665cd
fix: more yul cmnts
0xrusowsky Sep 20, 2025
7c387af
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 21, 2025
a3e947b
Fix config test, typos
grandizzy Sep 22, 2025
f18bd42
wip
0xrusowsky Sep 22, 2025
c326eb4
fix: new call alignement cases
0xrusowsky Sep 22, 2025
64133ed
Merge branch 'rusowsky/fmt-solar' of github.com:foundry-rs/foundry in…
0xrusowsky Sep 22, 2025
668884c
Merge branch 'master' into rusowsky/fmt-solar
grandizzy Sep 22, 2025
9baccbc
Fix tests
grandizzy Sep 22, 2025
a4d33e7
fix: return + bin ops + calls
0xrusowsky Sep 22, 2025
af519b6
Merge branch 'rusowsky/fmt-solar' of github.com:foundry-rs/foundry in…
0xrusowsky Sep 22, 2025
fc84055
style: clippy
0xrusowsky Sep 22, 2025
8531cff
feat: wrap long comments and merge with next line
0xrusowsky Sep 22, 2025
2b1419e
Merge branch 'master' into rusowsky/fmt-solar
0xrusowsky Sep 23, 2025
3394f98
fix: stale test
0xrusowsky Sep 23, 2025
52c3ce6
style: rmv comments
0xrusowsky Sep 23, 2025
38464b3
Merge branch 'rusowsky/fmt-solar' of github.com:foundry-rs/foundry in…
0xrusowsky Sep 23, 2025
8e26664
fmt nits (#11750)
grandizzy Sep 24, 2025
797a5c2
Merge branch 'master' into rusowsky/fmt-solar
grandizzy Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_STORE
/target*
/*.sol
out/
snapshots/
out.json
Expand All @@ -18,4 +19,4 @@ _
.vite
.wrangler
build
*.zip
*.zip
21 changes: 6 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ op-alloy-flz = "0.13.1"
revm = { version = "29.0.0", default-features = false }
revm-inspectors = { version = "0.29.0", features = ["serde"] }
op-revm = { version = "10.0.0", default-features = false }

## alloy-evm
alloy-evm = "0.20.1"
alloy-op-evm = "0.20.1"
Expand Down Expand Up @@ -353,10 +352,12 @@ jiff = "0.2"
heck = "0.5"
uuid = "1.17.0"
flate2 = "1.1"
snapbox = { version = "0.6", features = ["json", "regex", "term-svg"] }

## Pinned dependencies. Enabled for the workspace in crates/test-utils.

# testing
snapbox = { version = "0.6", features = ["json", "regex", "term-svg"] }

# Use unicode-rs which has a smaller binary size than the default ICU4X as the IDNA backend, used
# by the `url` crate.
# See the `idna_adapter` README.md for more details: https://docs.rs/crate/idna_adapter/latest
Expand Down
1 change: 1 addition & 0 deletions crates/chisel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ path = "bin/main.rs"

[dependencies]
# forge
forge-doc.workspace = true
forge-fmt.workspace = true
foundry-cli.workspace = true
foundry-common.workspace = true
Expand Down
17 changes: 3 additions & 14 deletions crates/chisel/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use crate::{
};
use alloy_primitives::{Address, hex};
use eyre::{Context, Result};
use forge_fmt::FormatterConfig;
use foundry_config::RpcEndpointUrl;
use foundry_config::{FormatterConfig, RpcEndpointUrl};
use foundry_evm::{
decode::decode_console_logs,
traces::{
Expand Down Expand Up @@ -66,18 +65,8 @@ pub struct EtherscanABIResponse {

/// Helper function that formats solidity source with the given [FormatterConfig]
pub fn format_source(source: &str, config: FormatterConfig) -> eyre::Result<String> {
match forge_fmt::parse(source) {
Ok(parsed) => {
let mut formatted_source = String::default();

if forge_fmt::format_to(&mut formatted_source, parsed, config).is_err() {
eyre::bail!("Could not format source!");
}

Ok(formatted_source)
}
Err(_) => eyre::bail!("Formatter could not parse source!"),
}
let formatted = forge_fmt::format(source, config).into_result()?;
Ok(formatted)
}

impl ChiselDispatcher {
Expand Down
2 changes: 1 addition & 1 deletion crates/chisel/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! execution helpers.

use eyre::Result;
use forge_fmt::solang_ext::{CodeLocationExt, SafeUnwrap};
use forge_doc::solang_ext::{CodeLocationExt, SafeUnwrap};
use foundry_common::fs;
use foundry_compilers::{
Artifact, ProjectCompileOutput,
Expand Down
3 changes: 2 additions & 1 deletion crates/cli/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use alloy_json_abi::JsonAbi;
use alloy_primitives::{U256, map::HashMap};
use alloy_provider::{Provider, network::AnyNetwork};
use eyre::{ContextCompat, Result};
use forge_fmt::FormatterConfig;
use foundry_common::{
provider::{ProviderBuilder, RetryProvider},
shell,
Expand Down Expand Up @@ -100,7 +101,7 @@ fn env_filter() -> tracing_subscriber::EnvFilter {

pub fn abi_to_solidity(abi: &JsonAbi, name: &str) -> Result<String> {
let s = abi.to_sol(name, None);
let s = forge_fmt::format(&s)?;
let s = forge_fmt::format(&s, FormatterConfig::default()).into_result()?;
Ok(s)
}

Expand Down
15 changes: 15 additions & 0 deletions crates/common/src/comments/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ pub enum CommentStyle {
BlankLine,
}

impl CommentStyle {
pub fn is_mixed(&self) -> bool {
matches!(self, Self::Mixed)
}
pub fn is_trailing(&self) -> bool {
matches!(self, Self::Trailing)
}
pub fn is_isolated(&self) -> bool {
matches!(self, Self::Isolated)
}
pub fn is_blank(&self) -> bool {
matches!(self, Self::BlankLine)
}
}

#[derive(Clone, Debug)]
pub struct Comment {
pub lines: Vec<String>,
Expand Down
Loading
Loading