difftreelog
fix(fmt) multiline comment whitespace handling
in: master
2 files changed
cmds/jrsonnet-fmt/src/comments.rsdiffbeforeafterboth--- a/cmds/jrsonnet-fmt/src/comments.rs
+++ b/cmds/jrsonnet-fmt/src/comments.rs
@@ -72,7 +72,7 @@
if matches!(loc, CommentLocation::ItemInline) {
p!(pi: str(" "));
}
- p!(pi: str("/* ") string(lines[0].trim().to_string()) str(" */"))
+ p!(pi: str("/* ") string(lines[0].trim().to_string()) str(" */") nl)
} else if !lines.is_empty() {
fn common_ws_prefix<'a>(a: &'a str, b: &str) -> &'a str {
let offset = a
cmds/jrsonnet-fmt/src/main.rsdiffbeforeafterboth372 return p!(new: str("{ }"));372 return p!(new: str("{ }"));373 }373 }374 let mut pi = p!(new: str("{") >i nl);374 let mut pi = p!(new: str("{") >i nl);375 for mem in children.into_iter() {375 for (i, mem) in children.into_iter().enumerate() {376 if mem.should_start_with_newline {376 if mem.should_start_with_newline && i != 0 {377 p!(pi: nl);377 p!(pi: nl);378 }378 }379 p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));379 p!(pi: items(format_comments(&mem.before_trivia, CommentLocation::AboveItem)));