-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Nested ternary indentation changes #5476
Copy link
Copy link
Closed
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:questionQuestions and support requests. Please use Stack Overflow for them, not the issue tracker.Questions and support requests. Please use Stack Overflow for them, not the issue tracker.
Description
Prettier 1.15.2
Playground link
--parser babylonInput:
change.to.line < pos.line
? pos.ch
: change.text.length <= 1
? pos.ch - (change.to.ch - change.from.ch) + sumLengths(change.text)
: pos.ch - change.to.ch + last(change.text).lengthOutput:
change.to.line < pos.line
? pos.ch
: change.text.length <= 1
? pos.ch - (change.to.ch - change.from.ch) + sumLengths(change.text)
: pos.ch - change.to.ch + last(change.text).length;Expected behavior:
Hi, I'm not sure when this prettier change was made, but it used to be the case that such ternary expressions were indented like the input text. Recently it seems that we get the shown output instead. I think the former is certainly superior for communicating intent. Was this an intended indentation (hah) change?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:questionQuestions and support requests. Please use Stack Overflow for them, not the issue tracker.Questions and support requests. Please use Stack Overflow for them, not the issue tracker.