Skip to content

Commit 51821f2

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

File tree

1 file changed

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

1 file changed

+6
-11
lines changed

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

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

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

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

0 commit comments

Comments
 (0)