Skip to content

Improve the placement of comments#1193

Closed
gpetiot wants to merge 2 commits intoocaml-ppx:masterfrom
gpetiot:cmt-partition
Closed

Improve the placement of comments#1193
gpetiot wants to merge 2 commits intoocaml-ppx:masterfrom
gpetiot:cmt-partition

Conversation

@gpetiot
Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot commented Dec 13, 2019

still in progress:

  • move the algorithm and the abstraction from Cmts to Source
  • fix the regressions when formatting ocamlformat source (make fmt)
  • fix the regressions in the tests (make test)
  • test on big projects (dune, mirage, etc.)
  • cleanup and document

The goal is only to improve the maintainability, bugs will be fixed in future pull requests, to keep the diff of this one short enough.

@gpetiot gpetiot changed the title [WIP] redesign the comment placement [WIP] Internal: redesign the comment placement Dec 27, 2019
@gpetiot gpetiot added the no changelog set this to bypass the CI check for changelog entries label Jan 23, 2020
@gpetiot gpetiot mentioned this pull request Feb 17, 2020
@emillon
Copy link
Copy Markdown
Collaborator

emillon commented Apr 7, 2020

I (finally!) had a look at this. If I understand it correctly, the core change is the change from partition_after_prev_or_before_next to Source.cmt_placement. I have some remarks on the implementation itself but it might a bit early to go in too much detail.

The or-pattern changes seem to be a net improvement to me! And the rules seems much simpler to understand.

It's a bit early to talk integration, but if you can continue improving that on the side and have net wins like the or-patterns I think this can balance the large diff this is going to have. We can also gate that behind a feature flag if the outcome is not super clear.

@gpetiot gpetiot changed the title [WIP] Internal: redesign the comment placement Improve the placement of comments Jul 10, 2020
@gpetiot
Copy link
Copy Markdown
Collaborator Author

gpetiot commented Mar 8, 2021

I'm closing this one because:

  • it diverged from master too much and it's painful to maintain
  • the implementation is even more difficult to maintain than master's
  • I will explore the approach of attaching the comments only once, just after the parsing, instead of after each iteration until we reach a fixpoint, for that I will work on having ast passes (and one of these passes will attach the comments in the ast)

@gpetiot gpetiot closed this Mar 8, 2021
@gpetiot gpetiot deleted the cmt-partition branch March 8, 2021 18:12
@hhugo
Copy link
Copy Markdown
Collaborator

hhugo commented Mar 8, 2021

I will explore the approach of attaching the comments only once, just after the parsing, instead of after each iteration until we reach a fixpoint, for that I will work on having ast passes (and one of these passes will attach the comments in the ast)

You'll still need to make sure you reach a fix point with the comment placement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog set this to bypass the CI check for changelog entries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants