Commit 9d38af9
feat(fmt): rewrite formatter using Solar and a structured algorithm (#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]>1 parent f653eda commit 9d38af9
File tree
156 files changed
+9215
-6562
lines changed- crates
- chisel
- src
- cli/src/utils
- common/src/comments
- config/src
- doc
- src
- parser
- preprocessor
- solang_ext
- writer
- fmt
- src
- pp
- state
- testdata
- ArrayExpressions
- BlockCommentsFunction
- BlockComments
- ConstructorModifierStyle
- ContractDefinition
- DocComments
- EmitStatement
- EnumDefinition
- EnumVariants
- ForStatement
- FunctionCallArgsStatement
- FunctionDefinitionWithFunctionReturns
- FunctionDefinition
- FunctionType
- IfStatement
- ImportDirective
- InlineDisable
- LiteralExpression
- MappingType
- NamedFunctionCallExpression
- NonKeywords
- NumberLiteralUnderscore
- OperatorExpressions
- ReprosCalls
- Repros
- ReturnStatement
- RevertNamedArgsStatement
- RevertStatement
- SimpleComments
- SortedImports
- StructDefinition
- ThisExpression
- TrailingComma
- TryStatement
- UnitExpression
- VariableAssignment
- VariableDefinition
- WhileStatement
- YulStrings
- Yul
- tests
- forge
- src/cmd
- tests/cli
- test-utils
- docs/dev
- testdata/default
- cheats
- fork
- fuzz/invariant/common
- repros
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
156 files changed
+9215
-6562
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
275 | | - | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
364 | 363 | | |
365 | 364 | | |
366 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 72 | + | |
| 73 | + | |
84 | 74 | | |
85 | 75 | | |
86 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 39 | + | |
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
47 | 43 | | |
48 | | - | |
| 44 | + | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
53 | | - | |
| 49 | + | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
57 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | | - | |
| 280 | + | |
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| |||
298 | 305 | | |
299 | 306 | | |
300 | 307 | | |
| 308 | + | |
301 | 309 | | |
302 | 310 | | |
303 | 311 | | |
304 | | - | |
| 312 | + | |
305 | 313 | | |
306 | 314 | | |
307 | 315 | | |
| |||
428 | 436 | | |
429 | 437 | | |
430 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
431 | 444 | | |
432 | 445 | | |
433 | 446 | | |
| |||
0 commit comments