Skip to content

Commit 03edac5

Browse files
xteraoCopilot
andcommitted
Refactor CONFLICT keyword type branch handling
Co-authored-by: Copilot <[email protected]>
1 parent 88c1c99 commit 03edac5

File tree

1 file changed

+7
-11
lines changed
  • src/main/kotlin/org/domaframework/doma/intellij/formatter/util

1 file changed

+7
-11
lines changed

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,16 @@ class SqlBlockUtil(
126126

127127
IndentType.CONFLICT -> {
128128
if (lastGroupBlock is SqlConflictClauseBlock) {
129-
when (keywordText) {
130-
"conflict" -> {
131-
lastGroupBlock.conflictType = OnConflictKeywordType.CONFLICT
129+
lastGroupBlock.conflictType =
130+
when (keywordText) {
131+
"conflict" -> OnConflictKeywordType.CONFLICT
132+
"constraint" -> OnConflictKeywordType.CONSTRAINT
133+
else -> OnConflictKeywordType.UNKNOWN
132134
}
133-
"constraint" -> {
134-
lastGroupBlock.conflictType = OnConflictKeywordType.CONSTRAINT
135-
}
136-
else -> {
137-
lastGroupBlock.conflictType = OnConflictKeywordType.UNKNOWN
138-
}
139-
}
140135
return SqlKeywordBlock(child, indentLevel, sqlBlockFormattingCtx)
136+
} else {
137+
return SqlConflictClauseBlock(child, sqlBlockFormattingCtx)
141138
}
142-
return SqlConflictClauseBlock(child, sqlBlockFormattingCtx)
143139
}
144140

145141
else -> return SqlKeywordBlock(child, indentLevel, sqlBlockFormattingCtx)

0 commit comments

Comments
 (0)