diff --git a/rust/kcl-lib/src/unparser.rs b/rust/kcl-lib/src/unparser.rs index 1330b930d..83177c982 100644 --- a/rust/kcl-lib/src/unparser.rs +++ b/rust/kcl-lib/src/unparser.rs @@ -192,7 +192,7 @@ impl Node { result.push_str(&indentation); result.push_str(comment); } - if !comment.ends_with("*/") && !result.ends_with("\n\n") && result != "\n" { + if !result.ends_with("\n\n") && result != "\n" { result.push('\n'); } } @@ -1022,6 +1022,20 @@ bar = 0 assert_eq!(output, input); } + #[test] + fn recast_annotations_with_block_comment() { + let input = r#"/* Start comment + +sdfsdfsdfs */ +@settings(defaultLengthUnit = in) + +foo = 42 +"#; + let program = crate::parsing::top_level_parse(input).unwrap(); + let output = program.recast(&Default::default(), 0); + assert_eq!(output, input); + } + #[test] fn test_recast_if_else_if_same() { let input = r#"b = if false {