New issue
Advanced search Search tips

Issue 800955 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , iOS , Chrome , Mac , Fuchsia
Pri: 3
Type: Bug



Sign in to add a comment

gn: Scope-in-list is formatted really badly

Project Member Reported by scottmg@chromium.org, Jan 10 2018

Issue description

The Fuchsia team uses scopes in lists. I don't think scopes could be used like that when format was written, but in any case, it doesn't do a good job.

When there's >= 2 it's not too bad:

  tests = [
    {
      name = "elements_test"
    },
    {
      name = "eapol_crypto_test"
    },
  ]

but with only one it's ugly:

  tests = [ {
        name = "elements_test"
      } ]




 
Project Member

Comment 1 by bugdroid1@chromium.org, Jan 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9b2c266d5882c89c65a1095d9e5d68e435ede1f3

commit 9b2c266d5882c89c65a1095d9e5d68e435ede1f3
Author: Scott Graham <scottmg@chromium.org>
Date: Thu Jan 11 19:18:46 2018

gn format: Better formatting of list-of-single-scope

Fuchsia uses these for test specifications in packages. Blocks are
always formatted multiline, but the list formatting didn't account for
that, so it just turned into a mess when there was only a single element
in the list (see linked bug).

Formatting changes:
https://chromium-review.googlesource.com/c/chromium/src/+/861256

Bug:  800955 
Change-Id: I4ab0866d0917071ba94d011c455499a3ba8fb552
Reviewed-on: https://chromium-review.googlesource.com/861282
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528703}
[modify] https://crrev.com/9b2c266d5882c89c65a1095d9e5d68e435ede1f3/tools/gn/command_format.cc
[modify] https://crrev.com/9b2c266d5882c89c65a1095d9e5d68e435ede1f3/tools/gn/command_format_unittest.cc
[add] https://crrev.com/9b2c266d5882c89c65a1095d9e5d68e435ede1f3/tools/gn/format_test_data/070.gn
[add] https://crrev.com/9b2c266d5882c89c65a1095d9e5d68e435ede1f3/tools/gn/format_test_data/070.golden

Status: Fixed (was: Assigned)
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 12 2018

Sign in to add a comment