Page MenuHomePhabricator

Correctly Indent Nested JavaScript Literals.
ClosedPublic

Authored by JaredNeil on Jun 2 2017, 5:19 PM.

Details

Summary

Nested literals are sometimes only indented by 2 spaces, instead of respecting the IndentWidth option.
There are existing unit tests (FormatTestJS.ArrayLiterals) that only pass because the style used to test them uses an IndentWidth of 2.
This change removes the magic 2 and always uses the IndentWidth.
I've added 6 tests. The first 4 of these tests fail before this change, while the last 2 already pass, but were added just to make sure it the change works with all types of braces.

Diff Detail

Repository
rL LLVM

Event Timeline

JaredNeil created this revision.Jun 2 2017, 5:19 PM
djasper edited reviewers, added: mprobst; removed: djasper.Jun 6 2017, 5:30 AM
djasper added a subscriber: cfe-commits.
mprobst accepted this revision.Jun 6 2017, 5:33 AM

LGTM

This revision is now accepted and ready to land.Jun 6 2017, 5:33 AM
This revision was automatically updated to reflect the committed changes.