Proposal for an "ocsigen" OCamlformat profile#857
Conversation
|
In the last commit, I add an option to see more easily the end of "big" expression. It makes both reading and editing easier but it re-add the 1500 removed lines. I explain it better in the commit message. |
|
I'm ok with these changes, except the indentation of comments. I recently added to the default The ocp-indent compat is not a big deal. Most the changes I see are closing parenthesis on a single line (but it's ok as it follow our "readability" principle) |
4191cd5 to
11ccf39
Compare
This modifies the OCamlformat profile to make it possible to upstream it
into OCamlformat.
- Remove the "ocp-indent-compat" option
This option does more than what the doc says and enables formattings
that cannot be set with any other option.
It is very hard to maintain within OCamlformat and setting it in the
ocsigen profile would create a large maintenance cost.
Removing this option causes a lot of changes to the formatting but some
of the changes could be reverted by adding options to OCamlformat.
Something that was harder to do with the option set.
This also fixes a few bugs, like commas in tuple types or in header
comments, and allows using parse-docstrings without also formatting the
regular comments.
- Add "indicate-multiline-delimiters=closing-on-separate-line"
This adds a newline before the closing parenthese around a multiline
expression. This makes reading easier by delimiting the "big" expression
and editing easier by moving the parentheses that are not part of the
"small" expression to an other line.
(match .. with
| .. ->
some
(long
(expression)))
becomes:
( match .. with
| .. ->
some
(long
(expression))
)
- Remove options equal to the default
11ccf39 to
18b8bbb
Compare
|
Thanks for your feedback! I removed the formatting of comments and redid the change the latest version of OCamlformat. |
|
Here's how the formatting of comments (but not of documentation) would look: Julow@7b05b9c |
I open this PR to ask for comments. I'd like to create an "ocsigen" profile in OCamlformat (the name can be debated) but it can't match exactly the profile used in ocsigen projects.
The reason is the
ocp-indent-compatoption, which is very unstable and is hard to maintain within OCamlformat. This option doesn't do what it says and causes formatting changes after each releases of OCamlformat. Internally, it just turns on many formatting specific to the janestreet profile.It's not reasonable to use it in an other profile because it causes bugs in combination with other options that are very hard to debug.
This is the output of the profile I propose for the ocsigen projects.
Advantages:
(fun .. -> ..), which is in the spirit of the previous profile.*)of copyright headers is aligned with the rest of the comment.Other changes: