mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Make Collection formattable
This commit is contained in:
parent
2eb9243942
commit
5c6d2a909e
2 changed files with 11 additions and 4 deletions
|
@ -3,7 +3,7 @@ use crate::{
|
|||
spaces::{fmt_comments_only, fmt_spaces, NewlineAt, INDENT},
|
||||
Buf,
|
||||
};
|
||||
use roc_parse::ast::{AliasHeader, AssignedField, Expr, Tag, TypeAnnotation};
|
||||
use roc_parse::ast::{AliasHeader, AssignedField, Collection, Expr, Tag, TypeAnnotation};
|
||||
use roc_parse::ident::UppercaseIdent;
|
||||
use roc_region::all::Loc;
|
||||
|
||||
|
@ -83,6 +83,15 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Formattable for Collection<'a, T>
|
||||
where
|
||||
T: Formattable,
|
||||
{
|
||||
fn is_multiline(&self) -> bool {
|
||||
self.items.iter().any(|item| item.is_multiline()) || !self.final_comments().is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
/// A Located formattable value is also formattable
|
||||
impl<T> Formattable for Loc<T>
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue