When the input string contains many (about 25) nested function calls in JavaScript, prettier.format()
takes about 2.5 minutes to return. This seems to occur when coreFormat()
converts the AST to a document (in printAstToDoc()
).
Environment:
Prettier 1.13.5
Playground link
Input:
_c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [ _c("div", [_c("div", [_c("div")])]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])
Output:
(same as input after 159 seconds)
Expected behavior:prettier.format(input)
returns within a few seconds (much sooner than 159 seconds)
naotokono, duailibe, suchipi, aldarund, TheAlexLichter and 7 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4