ITADN

Unary minus can be reformatted into a comment

#1075ClosedNathanSnail 创建于 2026-03-05
bug
N
NathanSnailcommented
Repeated use of unary minus on a long line can cause code to be reformatted into a comment. Short lines are handled correctly and formatted into `-(-x)`. To reproduce: Create the following program: ```lua _ = (- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5) ``` Observe that `stylua -c` suggests ```diff 1 |-_ = (- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5) 1 |+_ = ----------------------------------------5 ``` which is incorrect.
关闭于 2026-03-07 0 条评论