From 280dbf66b985d4f97eedee5447c6f34f003d70fe Mon Sep 17 00:00:00 2001 From: "Anantachai Saothong (Manta)" Date: Mon, 8 May 2017 13:02:38 +0700 Subject: [PATCH] Fixed an extra new-line before a single-line comment --- edge/format.js | 4 ++++ spec/comment-single-line/input.styl | 7 ++++++- spec/comment-single-line/output.styl | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/edge/format.js b/edge/format.js index 1d2e133..41d5991 100644 --- a/edge/format.js +++ b/edge/format.js @@ -964,6 +964,10 @@ function format(content, options = {}) { } } + if (commentNodes.length > 0) { + commentNodes[0].insertNewLineAbove = false + } + return commentNodes } diff --git a/spec/comment-single-line/input.styl b/spec/comment-single-line/input.styl index 41cbd49..12ecb49 100644 --- a/spec/comment-single-line/input.styl +++ b/spec/comment-single-line/input.styl @@ -7,17 +7,22 @@ //comment-7 //comment-8 + + //comment-9 + //comment-10 //comment-11 .class2 display block var='http://example.com'//comment-11 + +//comment-12 .class3 position static display none - //comment-12 + //comment-13 .class4 display block \ No newline at end of file diff --git a/spec/comment-single-line/output.styl b/spec/comment-single-line/output.styl index 7fd9422..17e20c3 100644 --- a/spec/comment-single-line/output.styl +++ b/spec/comment-single-line/output.styl @@ -18,12 +18,13 @@ } } +// comment-12 .class3 { display: none; position: static; } -// comment-12 +// comment-13 .class4 { display: block; } \ No newline at end of file