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
[RFC] Introduce infiniteWidth document #680
Conversation
That's strange, I would like to look into this more because it feels like it's working around a bug. Does it involve |
For some reason I don't understand, breakParent doesn't have the intended effect. But having a document that always puts the remaining with to < 0 does. I'm pretty sure that we should actually fix the issue with breakParent but wanted to show a solution that would work. Fixes prettier#625 Fixes prettier#616
3cebadd
to
28ec75b
Compare
Just rebased it |
Thanks. I've been very busy recently so sorry I haven't had a chance to look at this yet. Tomorrow is pretty busy as well but I'll try to find time for this. (Usually if I have time I skim through all the other issues/prs :p) |
I took a look at this. I don't know the solution yet, but here's what I found:
I still wish we didn't keep objects expanded. :)
diff --git a/src/printer.js b/src/printer.js
index 3a9e6e8..171670c 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -711,18 +711,17 @@ function genericPrintNoParens(path, options, print) {
ifBreak(
canHaveTrailingComma && shouldPrintComma(options) ? "," : ""
),
indent(
parentIsUnionTypeAnnotation ? 2 : 0,
concat([options.bracketSpacing ? line : softline, rightBrace])
),
path.call(print, "typeAnnotation")
- ]),
- { shouldBreak }
+ ])
);
}
case "PropertyPattern":
return concat([
path.call(print, "key"),
": ",
path.call(print, "pattern") But that removes the feature of breaking an object if anything inside it is broken, so we obviously can't do that. Your code happens to remove this so it "works", but you don't need This points to why this is happening: the I don't know the right solution yet. I'll come back to this tomorrow! |
Overtaken by #1032 |
For some reason I don't understand, breakParent doesn't have the intended effect. But having a document that always puts the remaining with to < 0 does.
I'm pretty sure that we should actually fix the issue with breakParent but wanted to show a solution that would work.
Fixes #625
Fixes #616