-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update emitQualifiedExpression, convert prefixes into chunks
Summary: Previously, `emitQualifiedExpressionSeveralInOneLine` took in a list of `prefixes`, which it then used to insert a `Break` between prefixes. In order to simplify the function, pull out the mapping of prefixes to groups. So before, the input looked like: ``` items: [rainbow, red, orange, shine(), yellow] prefixes: [3] prefixFillMode: Doc.FillMode.INDEPENDENT ``` Now it looks like: ``` chunks: [ chunk(expressions=[rainbow, red, orange, shine()], shouldKeepOnSameLine=true), chunk(expressions=[yellow], shouldKeepOnSameLine=false) ] ``` This makes it easier to work with in the function (and later to modify). Also note that the function is now responsible for deciding what kind of break to use for expressions that should be kept on the same line. The output is the same: ``` |-------------------------------- <- max line length |rainbow.red.orange.shine() | .yellow ``` Reviewed By: strulovich Differential Revision: D33373945 fbshipit-source-id: 06e74e28769d4a13bb3013b6042bd5b974a0dc8e
- Loading branch information
1 parent
36cd8eb
commit 61a9024
Showing
1 changed file
with
111 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters