Skip to content

Conversation

@0xrusowsky
Copy link
Contributor

@0xrusowsky 0xrusowsky commented Sep 7, 2025

Motivation

deprecates forge-fmt (solang-based) with forge-fmt-2 (solar-based)

Notes

forge-doc is built using solang's AST + used to rely on forge fmt.

in order to have a smoother migration, the old formatter has been removed and the required formatter/solang deps, have been temporarily moved into the doc/ crate. A follow-up PR to remove the solang dep from forge-doc will also take place.

@0xrusowsky 0xrusowsky marked this pull request as ready for review September 7, 2025 07:01
@DaniPopes
Copy link
Member

DaniPopes commented Sep 8, 2025

need to go through failures in forge fmt job from this repo, there's a few bugs with eg concatenated string literals and others which i can't tell if they're expected

@0xrusowsky
Copy link
Contributor Author

yes, i'm working on that should have it ready soon 🤝

@0xrusowsky 0xrusowsky moved this to In Progress in Foundry Sep 8, 2025
@0xrusowsky 0xrusowsky self-assigned this Sep 8, 2025
@0xrusowsky 0xrusowsky added this to the v1.4.0 milestone Sep 8, 2025
@0xrusowsky 0xrusowsky moved this from In Progress to Ready For Review in Foundry Sep 10, 2025
@0xrusowsky 0xrusowsky merged commit fd64e57 into rusowsky/fmt-solar Sep 10, 2025
19 of 23 checks passed
@0xrusowsky 0xrusowsky deleted the rusowsky/fmt-solar-merge branch September 10, 2025 12:31
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Sep 10, 2025
@grandizzy grandizzy moved this from Done to Completed in Foundry Sep 15, 2025
grandizzy added a commit that referenced this pull request Sep 24, 2025
…10907)

* init

* wip

* wip

* add dbg from prettyplease

* wip

* fixes, pragma&imports

* feat: using, types, literals

* feat: contract

* rm duplicate testdata

* wip: finish items; exprs, stmts

* wips

* feat: line_length, tab_width

* feat: contract_new_lines

* wip: single_line_statement_blocks

* tweaks

* chore: bump solar to latest main

* fix: test dir

* bump

* fix docs

* fix: adjust '()' for modifier calls

* test: typed yul does not exist anymore

argotorg/solidity#15329

* test: function parameters cannot be empty

* fix: adjust '()' for modifier calls for real

* fix: forge fmt hates '*' imports

* test: fix some invalid syntax

* test: disable-stop does not exist

* test: fix all parse errors

* fix: literal touchups

* bump

* test: add snapshotting

* test: update NumberLiteralUnderscore

* fixes

* struct space

* test: fix StructDefinition; empty structs are not allowed anyway

* test: update EventDefinition; matches Solidity style guide

* test: update EnumDefinition; same as StructDefinition

* test: update StructDefinition 2

* fix: comments in structs/enums

* test: update ErrorDefinition; matches Solidity style guide

* feat: print docs with other comments; update EnumVariants

* chore: update EnumDefinition, StructDefinition

* chore: readd post_break

* chore: rename is_hardbreak_tok

* feat: cleanups, more impls

* test: fix some compile errors

* feat: add FormatterResult with more variants

* stuff

* refactor: move print_item arms into their own functions

* chore: consolidate item hardbreaks

* fix: inline config parsing for block comments

* wip: rm FunctionLike, wip functions

* fix: clamp margin to max as well

* megawip

* feat: most of yul

* wip: try-catch

* wip: try-catch

* feat: print compact tuple

* wip: inline comments

* wip: try-cactch

* bump solar to have try-catch spans (#10832)

* wip comment fmt

* wip: array expr

* finish arrays

* block comments

* doc block comments

* ternary operators

* wip: fn header

* wip: fn header

* fix: doc block comments + block braces

* refactor state to organize helpers

* fix commasep with initial trailing cmnt

* fix: improve contract fmt

* fix: block comments + contract definition

* fix: wrap trailing comments

* fix fn alingment

* fix: rmv unecessary check

* working fn headers!!!

* block with comments at the beginning

* bump solar

* inline if statements based on user config

* operator expr

* finish binary operators + housekeeping

* housekeeping

* feat: binary expressions

* fix: string literals

* refactor comments + finish mappings

* named functions

* item spacing

* more flexible comments + return stmts

* var definition and flexible comments (#11093)

* comment wrapping

* sorted imports

* middle cmnts for arrays and literals with subdenominations

* revert: solar won't have spanned dataloc + subdenom

* refactor inline config + almost finished impl

* finish inline disable

* finish inline disable

* wip inline disable for repros

* passing repros

* almost working yul

* chore: remove unrelated changes / merge artifacts

* chore: remove unrelated changes / merge artifacts 2

* chore: remove unrelated changes / merge artifacts 3

* update fmt files to reflect current status

* enable both passes

* undo repros changes

* config: style = tabs

* test: inline config

* style: drop "lint" references in favor of "ids"

* function header config

* finish fn header config!

* re-enable 2nd pass

* finish fn header style

* feat: yul

* test: update tracking cmnts

* fix: yul repros

* chore: small comment

* chore: random + typos

* chore: rm dead code

* chore: rm unused vars

* chore: clippy --fix

* chore: some manual clippying

* chore: final clippy --fix

* refactor: tidy up

* yul: inline blocks

* yul: inline fn params

* ensure all tests are successful

* chore(fmt): merge new compiler setup (#11487)

* patch/impl/test pending repros

* style: typos

* docs: update readme

* docs: readme feedback

* style: clippy

* fix: merge conflicts

* fix: disable legacy fmt tests

* fix: config test

* fix(win): normalize breaks

* style: clippy

* fix(win): normalize escaped quotes

* fix(win): normalize multiline strings

* fix(win): only normalize line breaks for expected data

* chore: solar-powered fmt rollout (#11570)

* fix: comment spans for asm + try blocks

* fix: don't fmt yul addresses

* fix: empty buffer due to really long comment

* add repro

* Revert "fix: empty buffer due to really long comment"

This reverts commit f6768b4.

* fix: advance cursor correctly in print_comment

* fix: bin op indentation in complex exprs

* docs

Co-authored-by: DaniPopes <[email protected]>

* chore: clean up

* refactor: inline config

* chore: share inline config

* feat: remove HIR inline config visitor

* test: bless

* style: clippy

* feat(fmt): call chain awareness (#11611)

* wip: better call chains + return stmts + more tests

* fix: more yul cmnts

* fix: modifier cmnts + more yul cmnts

* fix: returns with bin ops

* fix breaks, still pending indentation

* wip: call cahins and nested... getting closer

* call stack to fmt complex calls

* fix: more yul cmnts

* Fix config test, typos

* wip

* fix: new call alignement cases

* Fix tests

* fix: return + bin ops + calls

* style: clippy

* feat: wrap long comments and merge with next line

* fix: stale test

* style: rmv comments

* fmt nits (#11750)

* nits

* Try no format

* chore: simplify call logic

* fix: reenable 2nd pass

* chore: cleanup

* docs: solar cmnt

* format testdata with new style

* fix: extra space in function type

* Readd relevant todo

* style: use span builder methods

* Review changes

* fix: remove outdated cmnt

* fix: test spacing

* Revert "fix: test spacing"

This reverts commit 541f4c8.

---------

Co-authored-by: 0xrusowsky <[email protected]>

---------

Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants