Peter Szilagyi avatar Peter Szilagyi committed d98e9b3

ocp-indent update from github.com/OCamlPro/ocp-indent

Comments (0)

Files changed (2)

ocaml/contrib/ocp-indent/src/block.ml

   let pad k path =
     match Nstream.next stream with
     | Some (tok,_) when tok.newlines = 0 ->
-        append k T (tok.spaces + 1) path
+        append k L (tok.spaces + 1) path
     | _ -> append k L 2 path in
 
   match tok.token with
     | SEMISEMI    -> append KNone L 0 (unwind_top t.path)
-    | OPEN        -> append KOpen L 2 (unwind_top t.path)
     | INCLUDE     -> append KInclude L 2 (unwind_top t.path)
     | EXCEPTION   -> append KException L 2 (unwind_top t.path)
     | BEGIN       -> append KBegin L 2 t.path
     | WHEN        -> append KWhen L 4 t.path
     | SIG         -> append KSig L 2 t.path
 
+    | OPEN when last_token t = Some LET -> append KOpen L 2 t.path
+
+    | OPEN -> append KOpen L 2 (unwind_top t.path)
+
     | LET when close_top_let t.last ->
         append KLet L 4 (unwind_top t.path)
 

ocaml/contrib/ocp-indent/tests/let-open.ml

+
+let _ =
+  (* ... *)
+  let open Option in
+  indented_line
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.