-
Notifications
You must be signed in to change notification settings - Fork 179
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
conventional style and ocp-indent #817
Comments
The Regarding the support of Since you apply For the moment there is no plan to automatically generate an |
@gpetiot thanks for your quick reply. Before I re-run my experiments again, is |
We didn't really extensively experiment with post-processing the ocamlformat output with ocp-indent so I unfortunately don't know which options would be required, (some people at Jane Street are doing it to some extent and we fix bugs when they are reported), that's something we need to do in the near future. |
@gpetiot thanks again. Maybe I lack the understanding of how to use ocamlformat, my impression was that it is best run as a save-hook for OCaml files. During development I like to not manually indent my code, that's why I use ocp-indent. Now, if I work on code, certainly ocp-indent will have to deal with the ocamlformat-formatted code, and my goal is to avoid indentation changes. This means rather than @samoht noted mirage/ocaml-cstruct#234 (comment) he has such a setup, but given that the indentation of ocamlformat and ocp-indent is different, I wonder how that works in more detail. |
This workflow makes sense, but I need to practice it myself so that I can spot the inconsistencies between ocamlformat and ocp-indent, we definitely need to add more tests covering this workflow in ocamlformat. |
cross-linking this to #476, which completes the coverage of ocp-indent options |
@hannesm out of curiosity is the compatibility with |
@gpetiot not really for me, I'm still using ocp-indent and no ocamlformat. does ocamlformat deal with syntactically invalid sources (i.e. can I just use it instead of ocp-indent)? Feel free to close this issue, as you find it important or not - I'm fine with ocp-indent and without ocamlformat. |
The |
@gpetiot oh thanks, I'll put trying ocamlformat again with the emacs plugin on my todo list. This is great news! :) |
Hello, I'd really like to use ocamlformat. I'm fine with the conventional style, since that seems to be well-thought. I put
profile=conventional
in my.ocamlformat
, and useddune build @fmt
anddune promote
to get an initial set of changes. I browsed a bit through the diff, and encountered the following indentation, which myocp-indent
(using default config, i.e. no.ocp-indent
around) disagrees with. I then putocp-indent-compat
into.ocamlformat
, and re-run thebuild
andpromote
, but this did not lead to a different indentation.Now, my question is whether there is a convenient way to have
ocp-indent
andocamlformat
agreeing on the indentation? Or is there a way to generate a.ocp-indent
from the ocamlformat conventional profile?Please take a look at the following function as an example (indentation of the
false
block in the pattern matching), its current layout:ocamlformat, profile=conventional, ocp-indent-compat
using ocp-indent on that block (1.7.0 no configuration file, i.e. default):
Any hints would be appreciated on how to combine the usage of ocp-indent and ocamlformat.
The text was updated successfully, but these errors were encountered: