Skip to content

Don’t break line on “<|” (pipe left) in multiline exprs if there isn’t already a line break #467

@dblsaiko

Description

@dblsaiko

The “<|” operator effectively reverses order of operations, kind of like putting everything behind it in parentheses. The way it formats however makes using it as that awkward since it adds a new line where parentheses wouldn’t.

If there isn’t already a line break before one of these, I think alejandra shouldn’t insert one.

Input (expected):

{
  a = attrsOf <| submodule {
    # ...
  };

  b = attrsOf (submodule {
    # ...
  });
}

Diff after formatting:

--- a	2025-07-22 19:16:44
+++ b	2025-07-22 19:16:49
@@ -1,7 +1,9 @@
 {
-  a = attrsOf <| submodule {
-    # ...
-  };
+  a =
+    attrsOf
+    <| submodule {
+      # ...
+    };
 
   b = attrsOf (submodule {
     # ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions