Skip to content

Commit

Permalink
🔥 Remove nobreak_wrap function as it's a bit much
Browse files Browse the repository at this point in the history
  • Loading branch information
MystPi committed Mar 4, 2024
1 parent 2387b0b commit eb044fd
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/pprint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ fn pretty_dict(d: Dict(decoder.Type, decoder.Type), color: Bool) -> Document {
pretty_type(field.1, color),
]
|> doc.concat
|> nobreak_wrap(doc.from_string("#("), doc.from_string(")"))
|> doc.prepend(doc.from_string("#("))
|> doc.append(doc.from_string(")"))
})
|> doc.concat_join([doc.from_string(","), doc.space])
|> wrap(
Expand Down Expand Up @@ -170,7 +171,8 @@ fn pretty_custom_type(
//
[single] ->
single
|> nobreak_wrap(open, close)
|> doc.prepend(open)
|> doc.append(close)
// However, multiple fields are indented because they would look weird otherwise.
_ ->
fields
Expand Down Expand Up @@ -226,10 +228,3 @@ fn wrap(
|> doc.append_docs([doc.break("", trailing), close])
|> doc.group
}

fn nobreak_wrap(document: Document, open: Document, close: Document) -> Document {
document
|> doc.prepend(open)
|> doc.append(close)
|> doc.group
}

0 comments on commit eb044fd

Please sign in to comment.