Skip to content

LESS "each" function breaks indentation #2380

@Some14u

Description

@Some14u

Description

The indentation for some less functions like list functions ("each" specifically) is broken.
https://lesscss.org/functions/#list-functions-each

Input

The code looked like this before beautification:

.my-function(@iterator) {
  each(@iterator, {
    color: red;           // payload: could be anything
  });

  .wrong-indentation-here {
    color: blue;
  }
}

Expected Output

The code should have looked like this after beautification:

.my-function(@iterator) {
  each(@iterator, {
    color: red;           // payload: could be anything
  });

  .wrong-indentation-here {
    color: blue;
  }
}

Actual Output

The code actually looked like this after beautification:

.my-function(@iterator) {
  each(@iterator, {
    color: red;           // payload: could be anything
  });

.wrong-indentation-here {
  color: blue;
}
}

Steps to Reproduce

Looks like the out-dent heuristic that fires when a } is followed by )… ; zeroes the indent even when brace_depth > 0.

Environment

OS:
Windows 10

Settings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions