Skip to content

Comment indentation on opening line of a block is incorrect #3255

@mqudsi

Description

@mqudsi

Similar to the just-filed #3254 but a different case and with a possibly different resolution, the following comment is re-indented incorrectly:

if foo { // this comment describes the entire block
    let x = y();
}

Which incorrectly interprets the comment as belonging within the if statement, which is
technically correct only in the most pedantic sense, as to human programmers (an admittedly slowly
dying species) it is fairly clear that the comment (regardless of its contents) describes the preceding
contents of the line and does not belong inside the block:

if foo {
    // this comment describes the entire block
    let x = y();
}

As now the comment appears to describe the first line of the block (let x = y();) and not the
block itself. This should either not be reformatted or it should be reformatted to the following:

// this comment describes the entire block
if foo {
    let x = y();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions