Fix incorrect formatting in fluent API call#14911
Fix incorrect formatting in fluent API call#14911magnushiie wants to merge 1 commit intomicrosoft:masterfrom
Conversation
Also add test cases (2nd test case with comma is currently commented out) Partially fixes microsoft#14675
|
It's a bit hard to understand the indentation architecture, and this change might be the wrong place to fix it. Specifically, it's hard to understand how indentation and delta apply to multi-line nodes and the individual tokens belonging to them. |
|
The behavior in smartIndentOnUnclosedFunctionDeclaration04 baffles me, have to study it some more. The obviously incorrect fix to that test would be for the last 3 lines: -verifyIndentationAfterNewLine("4", 8);
-verifyIndentationAfterNewLine("5", 4);
-verifyIndentationAfterNewLine("6", 4);
+verifyIndentationAfterNewLine("4", 12);
+verifyIndentationAfterNewLine("5", 8);^
+verifyIndentationAfterNewLine("6", 8);On the other hand, if you type in the example in #14675, it's clear the smart indentation and re-formatting are out of sync already today. |
|
The fix is pretty trickey. The issue is that previously we consider two cases:
Consider a similar case with the issue at hand: Promise
.then(foo => {
console.log(foo);
})Here the indentation of function block is the same as the However in our case, Promise
.then(
foo
)The I'm thinking about a more comprehensive way to fix this. |
|
Hi I submitted a new PR at #14955 |
|
Closing this in favor of #14955 |
Also add test cases (2nd test case with comma is currently commented out)
Partially fixes #14675