You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
According to man page, usage of ocp-indent-config: strict_with sets function-indent-nested and match-indent-nested,
but it doesn't seem happen - neither ocamlformat --ocp-indent-config --print-config shows changed value, nor behavior changes.
This create conflict between ocamlformat and ocp-indent because each of them forces its own indentation.
How to Reproduce
Steps to reproduce the behavior:
Create .ocp-indent file (all params are excplicitly set defaults):
match_clause = 2
with = 0
strict_with = never
Create test.ml file:
let f x =
match [] with
| [] ->
(match x with
| 1 -> ()
| _ -> ());
()
| _ -> ()
Run ocp-indent to check that indentation left untouched.
To give some context, ocamlformat never aimed at subsuming ocp-indent, nor be fully compatible. Because a few of ocp-indent settings don't make sense from ocamlformat's pov, I don't remember which ones, but that's the conclusion I made when I implemented the ocp-indent-compat option back then.
The goal of the ocp-indent-compat option was to make it easier for ocp-indent to run after ocamlformat, as some patterns were easier than others for ocp-indent to process (e.g. if some symbols are at the end of the line vs at the beginning of the line the indentation might differ). This option was necessary for Jane Street projects as they were applying ocp-indent after ocamlformat.
The doc might need to be updated indeed, maybe this option sets too high expectations.
(Imho we might as well remove the feature once this is not useful for Jane Street anymore)
Describe the bug
According to man page, usage of ocp-indent-config:
strict_with sets function-indent-nested and match-indent-nested
,but it doesn't seem happen - neither
ocamlformat --ocp-indent-config --print-config
shows changed value, nor behavior changes.This create conflict between ocamlformat and ocp-indent because each of them forces its own indentation.
How to Reproduce
Steps to reproduce the behavior:
ocamlformat --ocp-indent-config test.ml
:Note: '|' are under '(', not under letter 'm'.
6. Add to .ocamlformat:
ocamlformat --ocp-indent-config test.ml
- result is the same,match-indent-nested = never
setting is ignored.Additional info
Changing
strict_with = always
in .ocp-indent file and run ocp-indent again, changes test.ml to:The text was updated successfully, but these errors were encountered: