Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[RFC] Fix comment location for binary expressions #1043
The root cause is that we're calling
So, the way to fix it is to call
// Don't include the initial expression in the indentation // level. The first item is guaranteed to be the first // left-most expression. parts.length > 0 ? parts : "",
The consequence is that binary expressions are no longer indented correctly if expressions have a comment (but now it places the comment properly!), which seems like an okay trade-off.
I'm not sure if we should merge this one or instead refactor this code such that it doesn't rely on mutation and looking at the shape of the printed tree.