Improve TypedIdent spacing in formatting

This commit is contained in:
Joshua Warner 2021-12-05 12:58:48 -08:00
parent bd5b9700ca
commit e6eb9138f7
2 changed files with 5 additions and 11 deletions

View file

@ -184,7 +184,7 @@ fn fmt_typed_ident<'a>(buf: &mut Buf<'a>, entry: &TypedIdent<'a>, indent: u16) {
buf.indent(indent); buf.indent(indent);
buf.push_str(ident.value); buf.push_str(ident.value);
fmt_default_spaces(buf, spaces_before_colon, " ", indent); fmt_default_spaces(buf, spaces_before_colon, " ", indent);
buf.push(':'); buf.push_str(": ");
ann.value.format(buf, indent); ann.value.format(buf, indent);
} }
SpaceBefore(sub_entry, spaces) => { SpaceBefore(sub_entry, spaces) => {

View file

@ -2620,24 +2620,18 @@ mod test_fmt {
#[test] #[test]
fn single_line_platform() { fn single_line_platform() {
// There are many places that there should probably be spaces, e.g.:
// requires { model=>Model, msg=>Msg } { main : Effect {} }
// ^
// putLine : Str -> Effect {},
// ^
// TODO: improve spacing
module_formats_same( module_formats_same(
"platform folkertdev/foo \ "platform folkertdev/foo \
requires { model=>Model, msg=>Msg } { main :Effect {} } \ requires { model=>Model, msg=>Msg } { main : Effect {} } \
exposes [] \ exposes [] \
packages {} \ packages {} \
imports [ Task.{ Task } ] \ imports [ Task.{ Task } ] \
provides [ mainForHost ] \ provides [ mainForHost ] \
effects fx.Effect \ effects fx.Effect \
{ \ { \
putLine :Str -> Effect {}, \ putLine : Str -> Effect {}, \
putInt :I64 -> Effect {}, \ putInt : I64 -> Effect {}, \
getInt :Effect { value : I64, errorCode : [ A, B ], isError : Bool } \ getInt : Effect { value : I64, errorCode : [ A, B ], isError : Bool } \
} ", } ",
); );
} }