Skip to content

Fix child element indentation in multiline lists #3827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 34 commits into from

Conversation

saschanaz
Copy link
Contributor

@saschanaz saschanaz commented Jul 11, 2015

Fixes #3817, fixes #5834, fixes #9437.

Please don't do commit-by-commit review as some intermediate changes were later removed.

Note (July 1, 2016): This sadly reverts #8364.

Input:

return (
    h.div({
    },
        ""
    )
);

[3, {
}, {
    }]

Fix:

return (
    h.div({
    },
    ""
    )
);

[3, {
}, {
}]

@saschanaz saschanaz changed the title Fix argument indentation in multiline call/new expressions Fix child element indentation in multiline lists Jul 15, 2015
@saschanaz
Copy link
Contributor Author

Now waiting feedback.

@wgebczyk
Copy link

wgebczyk commented Aug 9, 2015

So after the fix we have:

return (
    h.div({
        className: "view-node-row",
        style: {
            width: width,
            height: rowHeight
        }
    },
    backgroundElement,
    centerElement,
    toolsElement,
    h.div({ className: "nodes" }, items)
    )
);

this means probably we will have this:

return (
    h.div(backgroundElement,
    centerElement,
    toolsElement,
    h.div({ className: "nodes" }, items)
    )
);

and seems that by unwrapping return we will have this:

h.div(backgroundElement,
centerElement,
toolsElement,
h.div({ className: "nodes" }, items)
);

Is that correct?

Honestly I don't like situation when function parameters are indented at same level as its function call.
But that's my preference...

@saschanaz
Copy link
Contributor Author

@wgebczyk No, this fix will affect only when:

  1. The end position of a parameter is in a different line with the start position of the list
  2. The start position of the parameter is in the same line with the start position of the list
foo({ // An object literal starts in the first line
}, // An object literal ends in the second line, not the first line
3 // Thus, no additional indentation here
),

foo(
    { // starts in the second line
    },  
    3 // Additional indentation here
);

foo({}, // starts and ends in the first line
    3 // Additional indentation here
);

@wgebczyk
Copy link

wgebczyk commented Aug 9, 2015

Seems to be reasonable. Thanks!

@mhegazy
Copy link
Contributor

mhegazy commented Mar 31, 2016

@vladima can you take a look?

@saschanaz saschanaz force-pushed the shorterParamListIndentFix branch from 09b168d to f52aa4b Compare July 1, 2016 03:00
@saschanaz saschanaz force-pushed the shorterParamListIndentFix branch from 3bba7c4 to 6b27eaf Compare December 16, 2016 16:52
@zpdDG4gta8XKpMCd
Copy link

can we merge it please?

@saschanaz
Copy link
Contributor Author

I'm closing this because this is incompatible with new PR #13574. I will open a cleaner PR if it is merged.

@saschanaz saschanaz closed this Jan 19, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep indentation level consistent in a multiline list Visual Studio formatting is wrong in some cases Indentation bug on array
5 participants