Skip to content
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

fix: [OCaml] Relocate dangling function line break #764

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This name should be decided amongst the team before the release.
- [#760](https://github.com/tweag/topiary/pull/760) Introduce optional `query_name` predicate, to help with query logging and debugging.

### Fixed
- [#720](https://github.com/tweag/topiary/pull/720) [#722](https://github.com/tweag/topiary/pull/722) [#723](https://github.com/tweag/topiary/pull/723) [#724](https://github.com/tweag/topiary/pull/724) [#735](https://github.com/tweag/topiary/pull/735) [#738](https://github.com/tweag/topiary/pull/738) [#739](https://github.com/tweag/topiary/pull/739) [#745](https://github.com/tweag/topiary/pull/745) [#755](https://github.com/tweag/topiary/pull/755) [#759](https://github.com/tweag/topiary/pull/759) Various OCaml improvements
- [#720](https://github.com/tweag/topiary/pull/720) [#722](https://github.com/tweag/topiary/pull/722) [#723](https://github.com/tweag/topiary/pull/723) [#724](https://github.com/tweag/topiary/pull/724) [#735](https://github.com/tweag/topiary/pull/735) [#738](https://github.com/tweag/topiary/pull/738) [#739](https://github.com/tweag/topiary/pull/739) [#745](https://github.com/tweag/topiary/pull/745) [#755](https://github.com/tweag/topiary/pull/755) [#759](https://github.com/tweag/topiary/pull/759) [#764](https://github.com/tweag/topiary/pull/764 Various OCaml improvements
- [#762](https://github.com/tweag/topiary/pull/762) Various Rust improvements
- [#744](https://github.com/tweag/topiary/pull/744) Nickel: fix the indentation of `in` for annotated multiline let-bindings
- [#761](https://github.com/tweag/topiary/pull/761) No longer use error code 1 for unspecified errors
Expand Down
5 changes: 5 additions & 0 deletions topiary-cli/tests/samples/expected/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1308,3 +1308,8 @@ let _ =
baz
@@ fun x ->
x

(* #546 Hanging forms *)
let _ =
somefun @@ fun x ->
body
5 changes: 5 additions & 0 deletions topiary-cli/tests/samples/input/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,3 +1249,8 @@ let _ =
baz
@@ fun x ->
x

(* #546 Hanging forms *)
let _ =
somefun @@
fun x -> body
27 changes: 27 additions & 0 deletions topiary-queries/queries/ocaml.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,33 @@
] @append_indent_end
)

; The following allows
;
; somefun @@
; fun x -> body
;
; to be formatted as
;
; somefun @@ fun x ->
; body
(infix_expression
(#scope_id! "relocate_dangling_function_line_break")
(concat_operator) @append_begin_scope @append_begin_measuring_scope
.
(fun_expression
"fun" @prepend_end_measuring_scope
"->" @append_end_scope
)
)
(infix_expression
(#multi_line_scope_only! "relocate_dangling_function_line_break")
(concat_operator)
.
(fun_expression
"->" @append_hardline
)
)

; Allow softlines in sequences and ppx sequences, such as
; let b =
; foo;
Expand Down
Loading