Skip to content

De-indent the object keyword in class types#2425

Merged
Julow merged 4 commits intoocaml-ppx:mainfrom
Julow:pcty-deindent-object
Sep 8, 2023
Merged

De-indent the object keyword in class types#2425
Julow merged 4 commits intoocaml-ppx:mainfrom
Julow:pcty-deindent-object

Conversation

@Julow
Copy link
Copy Markdown
Collaborator

@Julow Julow commented Sep 5, 2023

This is the first suggestion in #2423 (comment)

The previous indentation of the keyword was ambiguous as it was aligned with the previous and next lines.
This is similar to the formatting of module struct.

This is does not compose well with break-separators=before but I still think it's better than before:

class unix_mockup :
     foooo:string
  -> foooo:string
  -> foooo:string
  -> foooo:string
  -> foooo:string
  -> foooo:string
  ->
object
  method foo : string
end

The previous indentation of the keyword was ambiguous as it was aligned
with the previous and next lines.

This is similar to the formatting of module `struct`.
Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the new output tbh! Even in combination with break-separators=before it looks like an improvement to me.
LGTM!

@Julow
Copy link
Copy Markdown
Collaborator Author

Julow commented Sep 8, 2023

Let's include this in the next release.

@Julow Julow merged commit 63b7ff5 into ocaml-ppx:main Sep 8, 2023
Julow added a commit to Julow/opam-repository that referenced this pull request Sep 15, 2023
….26.1)

CHANGES:

### Changed

- Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow)
  The syntax of let-bindings changed sligthly in this version.
- Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow)
- \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow)
- \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow)
- \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow)

### Fixed

- Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow)
- Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot)
- Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow)
- Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow)
- Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
nberth pushed a commit to nberth/opam-repository that referenced this pull request Jun 18, 2024
….26.1)

CHANGES:

### Changed

- Compatible with OCaml 5.1.0 (ocaml-ppx/ocamlformat#2412, @Julow)
  The syntax of let-bindings changed sligthly in this version.
- Improved ocp-indent compatibility (ocaml-ppx/ocamlformat#2428, @Julow)
- \* Removed extra break in constructor declaration with comment (ocaml-ppx/ocamlformat#2429, @Julow)
- \* De-indent the `object` keyword in class types (ocaml-ppx/ocamlformat#2425, @Julow)
- \* Consistent formatting of arrows in class types (ocaml-ppx/ocamlformat#2422, @Julow)

### Fixed

- Fix dropped attributes on a begin-end in a match case (ocaml-ppx/ocamlformat#2421, @Julow)
- Fix dropped attributes on begin-end in an if-then-else branch (ocaml-ppx/ocamlformat#2436, @gpetiot)
- Fix non-stabilizing comments before a functor type argument (ocaml-ppx/ocamlformat#2420, @Julow)
- Fix crash caused by module types with nested `with module` (ocaml-ppx/ocamlformat#2419, @Julow)
- Fix ';;' formatting between doc-comments and toplevel directives (ocaml-ppx/ocamlformat#2432, @gpetiot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants