Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Unary minus can be reformatted into a comment #1075

@NathanSnail

Description

@NathanSnail

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:

_ = (- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5)

Observe that stylua -c suggests

1        |-_ = (- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5)
    1    |+_ = ----------------------------------------5

which is incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions