Grainfmt: Support formatter-ignore
in more places
#2040
Labels
grainfmt
Issues related to the Grain formatter
formatter-ignore
in more places
#2040
As per @ospencer at #1976 (comment)
We currently only support it on statements, so that's either top-level statements or statements within a block. We could open an issue to support it in more places, though it's a little tricky/could give unexpected results in some cases:
formatter-ignore
is supposed to apply to the next node rather than the next line, so it could be expensive to check for that. We can't make it apply to all 3 arguments because they're treated as three separate nodes. Formatting once would place them on separate lines, making theformatter-ignore
comment no longer apply to the second two nodes, so formatting again would actually format them (which is very bad behavior).Trying to just cut out that one line is even trickier business since you could easily split across AST nodes. So we'd probably need to do that expensive check instead, but now we've got a super expensive check for every AST node.
It might be possible to not make it horribly expensive, but I'd have to think about it.
The text was updated successfully, but these errors were encountered: