Skip to content

Commit 222793a

Browse files
committed
Fix SQL formatting by adjusting indentation and spacing in keyword group blocks
1 parent a77df00 commit 222793a

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/main/kotlin/org/domaframework/doma/intellij/formatter/block/group/keyword/condition/SqlConditionKeywordGroupBlock.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class SqlConditionKeywordGroupBlock(
3131
node: ASTNode,
3232
context: SqlBlockFormattingContext,
3333
) : SqlSecondOptionKeywordGroupBlock(
34-
node,
35-
context,
36-
) {
34+
node,
35+
context,
36+
) {
3737
var conditionalExpressionGroupBlock: SqlConditionalExpressionGroupBlock? = null
3838

3939
override fun setParentGroupBlock(lastGroup: SqlBlock?) {

src/main/kotlin/org/domaframework/doma/intellij/formatter/util/SqlBlockGenerator.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,32 +311,31 @@ class SqlBlockGenerator(
311311
child,
312312
sqlBlockFormattingCtx,
313313
)
314-
} else if ( rootBlock is SqlExistsGroupBlock){
314+
} else if (rootBlock is SqlExistsGroupBlock) {
315315
SqlKeywordBlock(
316316
child,
317317
IndentType.ATTACHED,
318318
sqlBlockFormattingCtx,
319319
)
320-
}
321-
else {
320+
} else {
322321
SqlConflictClauseBlock(
323322
child,
324323
sqlBlockFormattingCtx,
325324
)
326325
}
327326
} else if (SqlKeywordUtil.isConditionKeyword(keywordText)) {
328-
if(lastGroupBlock is SqlCreateKeywordGroupBlock){
329-
SqlKeywordBlock(
327+
if (lastGroupBlock is SqlCreateKeywordGroupBlock) {
328+
SqlKeywordBlock(
330329
child,
331330
IndentType.ATTACHED,
332331
sqlBlockFormattingCtx,
333-
)
334-
}else {
335-
SqlConditionKeywordGroupBlock(
336-
child,
337-
sqlBlockFormattingCtx,
338-
)
339-
}
332+
)
333+
} else {
334+
SqlConditionKeywordGroupBlock(
335+
child,
336+
sqlBlockFormattingCtx,
337+
)
338+
}
340339
} else {
341340
SqlSecondOptionKeywordGroupBlock(
342341
child,

src/main/kotlin/org/domaframework/doma/intellij/formatter/util/SqlKeywordUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class SqlKeywordUtil {
334334
"group" to setOf("within"),
335335
"by" to setOf("group", "order", "first", "partition"),
336336
"and" to setOf("between", "preceding"),
337-
// "if" to setOf("table", "index","view"),
337+
// "if" to setOf("table", "index","view"),
338338
"exists" to setOf("if", "where"),
339339
"conflict" to setOf("on"),
340340
"nothing" to setOf("do"),

0 commit comments

Comments
 (0)