Right now, when I format the following code,

let a = {
    x: true,
    y: false,
    z: true
};

let b = 
{
    x: true,
    y: false,
    z: true
};

I get this result:

let a = {
    x: true,
    y: false,
    z: true
};

let b =
    {
        x: true,
        y: false,
        z: true
    };

My goal is to get this as output:

let a =
{
    x: true,
    y: false,
    z: true
};

let b =
{
    x: true,
    y: false,
    z: true
};

Alternatively, I'd settle for having a unchanged and having b maintaining its indentation.

let b =
{
    x: true,
    y: false,
    z: true
};

We could solve this by using formatter on and off tags, but then the content of the object literal (such as callback functions and arrays) wouldn't get formatted anymore, so this is not a preferable solution.

These are the current formatting settings for "Wrapping and Braces": Wrapping and braces tab of the formatting settings for TypeScript

If there's a solution which only works in IntelliJ 2017 then that might be workable too, since we're looking into upgrading.

1

There are 1 best solutions below

0
On BEST ANSWER

Unfortunately Braces placement/Other does not affect object literals, so there is no way to make them formatted this way. Please follow WEB-7122 for updates