bitwisecook / vscode-tcl

Tcl for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=bitwisecook.tcl
MIT License
39 stars 20 forks source link

Formatting indentation error on comment after curly #8

Closed urbasus closed 2 years ago

urbasus commented 2 years ago

Code before formatting:

proc hello {} {
    if {[arcane expression]} { # comment explaining arcane expression
        do thing;
    }
}

After formatting:

proc hello {} {
    if {[arcane expression]} { # comment explaining arcane expression
    do thing;
}
}

Not sure whether formatter should move the comment according to some canonical style guide (line above or below), or just handle the indentation right.

bitwisecook commented 2 years ago

the formatter is quite dumb, it doesn't understand comments in that layout because that's against the internal style guide for the team I wrote this for.

fixing this requires a proper parser that actually understands the code, which isn't something I plan to write any time soon.