Skip to content

Commit 5df32fa

Browse files
committed
Fix to prevent unnecessary line breaks when there is whitespace before the first element.
1 parent 2f48acd commit 5df32fa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/kotlin/org/domaframework/doma/intellij/formatter/processor/SqlFormatPreProcessor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ class SqlFormatPreProcessor : PreFormatProcessor {
272272
prevElement: PsiElement?,
273273
text: String,
274274
): String =
275-
if (prevElement?.text?.contains(StringUtil.LINE_SEPARATE) == false) {
275+
if (prevElement?.text?.contains(StringUtil.LINE_SEPARATE) == false &&
276+
PsiTreeUtil.prevLeaf(prevElement) != null
277+
) {
276278
"${StringUtil.LINE_SEPARATE}$text"
277279
} else {
278280
text

0 commit comments

Comments
 (0)