mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
make fmt_comments_only more general
This commit is contained in:
parent
bc203371be
commit
25192fca10
4 changed files with 55 additions and 76 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::annotation::{Formattable, Newlines, Parens};
|
||||
use crate::spaces::{fmt_comments_only, fmt_spaces};
|
||||
use crate::spaces::{fmt_comments_only, fmt_spaces, NewlineAt};
|
||||
use bumpalo::collections::String;
|
||||
use roc_parse::ast::{Base, Pattern};
|
||||
|
||||
|
@ -133,7 +133,7 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
// Space
|
||||
SpaceBefore(sub_pattern, spaces) => {
|
||||
if !sub_pattern.is_multiline() {
|
||||
fmt_comments_only(buf, spaces.iter(), indent)
|
||||
fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent)
|
||||
} else {
|
||||
fmt_spaces(buf, spaces.iter(), indent);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ impl<'a> Formattable<'a> for Pattern<'a> {
|
|||
sub_pattern.format_with_options(buf, parens, newlines, indent);
|
||||
// if only_comments {
|
||||
if !sub_pattern.is_multiline() {
|
||||
fmt_comments_only(buf, spaces.iter(), indent)
|
||||
fmt_comments_only(buf, spaces.iter(), NewlineAt::Bottom, indent)
|
||||
} else {
|
||||
fmt_spaces(buf, spaces.iter(), indent);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue