-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hh_format pipe operator support - optional pretty print wrapping
Summary:hh_format pipe operator support. Can either keep all on one line, or wrap onto multiple lines (the common way). Reviewed By: int3 Differential Revision: D3004095 fb-gh-sync-id: 110ed48ef8d3838e10cf35abbfefb660729c02fc shipit-source-id: 110ed48ef8d3838e10cf35abbfefb660729c02fc
- Loading branch information
Showing
9 changed files
with
139 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?hh | ||
function piped(): int { | ||
// Pipe doesn't force you to format with a newline if you don't want. | ||
return f() |> g($$) |> h($$); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?hh | ||
function piped(): int { | ||
// Pipe doesn't force you to format with a newline if you don't want. | ||
return f() |> g($$) |> h($$); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?hh | ||
function piped(): int { | ||
$a = Foo::aaaaaaaaaaaaaaaaaaaaa() | ||
|> bar(Bar::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb()->g($$)) | ||
|> h($$); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?hh | ||
function piped(): int { | ||
$a = | ||
Foo::aaaaaaaaaaaaaaaaaaaaa() | ||
|> bar( | ||
Bar::bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb() | ||
->g($$), | ||
) | ||
|> h($$); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?hh | ||
function piped(): int { | ||
$a = Foo::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() | ||
->h(f() | ||
|> g($$) | ||
|> h($$)); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?hh | ||
function piped(): int { | ||
$a = | ||
Foo::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() | ||
->h( | ||
f() | ||
|> g($$) | ||
|> h($$), | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
hphp/hack/test/format/pipe_operator_pretty_print_wrapping.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?hh | ||
function piped(): void { | ||
// These are less than 80 width, but the pretty newlines are preserved. | ||
get_collection() | ||
|> map($$) | ||
|> filter($$); | ||
} |
7 changes: 7 additions & 0 deletions
7
hphp/hack/test/format/pipe_operator_pretty_print_wrapping.php.exp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?hh | ||
function piped(): void { | ||
// These are less than 80 width, but the pretty newlines are preserved. | ||
get_collection() | ||
|> map($$) | ||
|> filter($$); | ||
} |