Skip to content

Commit f8ba20a

Browse files
committed
Fix to prevent spaces from being inserted in comparison operator symbols
1 parent b25b329 commit f8ba20a

File tree

1 file changed

+12
-1
lines changed
  • src/main/kotlin/org/domaframework/doma/intellij/formatter/block

1 file changed

+12
-1
lines changed

src/main/kotlin/org/domaframework/doma/intellij/formatter/block/SqlFileBlock.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.domaframework.doma.intellij.formatter.block.comment.SqlDefaultComment
3232
import org.domaframework.doma.intellij.formatter.block.comment.SqlElBlockCommentBlock
3333
import org.domaframework.doma.intellij.formatter.block.comment.SqlElConditionLoopCommentBlock
3434
import org.domaframework.doma.intellij.formatter.block.comment.SqlLineCommentBlock
35+
import org.domaframework.doma.intellij.formatter.block.expr.SqlElAtSignBlock
3536
import org.domaframework.doma.intellij.formatter.block.expr.SqlElSymbolBlock
3637
import org.domaframework.doma.intellij.formatter.block.group.SqlNewGroupBlock
3738
import org.domaframework.doma.intellij.formatter.block.group.column.SqlColumnBlock
@@ -519,7 +520,7 @@ open class SqlFileBlock(
519520
return SqlCustomSpacingBuilder().getSpacing(childBlock2)
520521
}
521522

522-
if (childBlock2 is SqlOtherBlock) {
523+
if (childBlock1 !is SqlElSymbolBlock && childBlock1 !is SqlOtherBlock && childBlock2 is SqlOtherBlock) {
523524
return SqlCustomSpacingBuilder().getSpacing(childBlock2)
524525
}
525526

@@ -578,6 +579,16 @@ open class SqlFileBlock(
578579
return SqlCustomSpacingBuilder.normalSpacing
579580
}
580581

582+
if (childBlock1 is SqlElSymbolBlock && childBlock2 is SqlElSymbolBlock ||
583+
childBlock1 is SqlElAtSignBlock && childBlock2 is SqlElSymbolBlock ||
584+
childBlock1 is SqlOtherBlock && childBlock2 is SqlElSymbolBlock ||
585+
childBlock1 is SqlElSymbolBlock && childBlock2 is SqlElAtSignBlock ||
586+
childBlock1 is SqlOtherBlock && childBlock2 is SqlOtherBlock ||
587+
childBlock1 is SqlElSymbolBlock && childBlock2 is SqlOtherBlock
588+
) {
589+
return SqlCustomSpacingBuilder.nonSpacing
590+
}
591+
581592
val spacing: Spacing? = customSpacingBuilder?.getCustomSpacing(childBlock1, childBlock2)
582593
return spacing ?: spacingBuilder.getSpacing(this, childBlock1, childBlock2)
583594
}

0 commit comments

Comments
 (0)