Skip to content

Commit

Permalink
fix: Maintain terminal newline (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsutina authored Nov 28, 2024
1 parent 5e95eaa commit 0a18679
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class CommentsInBlockRemover private constructor(
private val errorListener: CollectingErrorListener,
private val blockName: String,
) : KotlinParserBaseListener() {
private var terminalNewlines = 0
private var terminalNewlines = Whitespace.countTerminalNewlines(tokens)
private val rewriter = Rewriter(tokens)
private val indent = Whitespace.computeIndent(tokens, input)
private val comments = Comments(tokens, indent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CommentsInBlockRemoverTest {
|otherBlock {
| // More comments
|}
|
""".trimMargin()

// When
Expand All @@ -42,6 +43,7 @@ class CommentsInBlockRemoverTest {
|otherBlock {
| // More comments
|}
|
""".trimMargin())
assertThat(commentsInBlockRemover.getFoundRemovableComments()).containsOnly(
"/* This is a block comment\n that spans multiple lines */",
Expand Down

0 comments on commit 0a18679

Please sign in to comment.