feat: foldable add ensure to use ensureSyntaxTree #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When I use
ensureSyntaxTreeto get the complete syntax tree, I want to fold all regions. So I callfoldableto get the from and to positions. However,foldableinternally still usessyntaxTree, which may return an incomplete tree, resulting in inaccurate foldRanges.Therefore, I added a fourth parameter
ensuretofoldable, allowing it to internally useensureSyntaxTree.This is my fold code, It does not work normally, if add ensure, it can work normally
I suggest you use
forceParsinghere, to move the state forward before you look for foldable ranges. Adding an extra boolean parameter that makes finding a fold range potentially take a large amount of time seems too messy and risky.Pull request closed