Skip to content

Incorrect indentation following single-line comments #493

Closed
@TamsynUlthara

Description

@TamsynUlthara

On both master and develop, a line following a single-line comment is incorrectly indented:

function func() {
  // comment
 // new indent starts here
}

obj = {
  // comment
 // new indent starts here
}

arr = [
  // comment
 // new indent starts here
]

call(
  // comment
 // new indent starts here
)

But indentation between single-line comments is (usually) fine:

function func() {
  // comment 1
  // new indent starts here
  // comment 2
}

obj = {
  // comment 1
  // new indent starts here
  // comment 2
}

arr = [
  // comment 1
  // new indent starts here
  // comment 2
]

But even those seem to break if your last action was deleting a line
between // comment 1 and // comment 2.

Calls seem a bit wonky:

call(
  // comment 1
    // new indent starts here
  // comment 2
)

And everything behaves differently if there's a non-comment line above the comments:

function func() {
  x
  // comment 1
    // new indent starts here
  // comment 2
}


obj = {
  x
  // comment 1
    // new indent starts here
  // comment 2
}

arr = [
  x
  // comment 1
  // new indent starts here
  // comment 2
]
call(
  x
  // comment 1
  // new indent starts here
  // comment 2
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions