File tree Expand file tree Collapse file tree 4 files changed +4
-23
lines changed
src/main/kotlin/org/domaframework/doma/intellij/formatter Expand file tree Collapse file tree 4 files changed +4
-23
lines changed Original file line number Diff line number Diff line change @@ -136,16 +136,7 @@ open class SqlBlock(
136136 (prevBlock.conditionType.isElse() || prevBlock.conditionType.isEnd())
137137 val hasNoChildrenExceptLast = parent.childBlocks.dropLast(1 ).isEmpty()
138138
139- if (parent.conditionType.isElse()) {
140- return prevBlocks.isEmpty()
141- }
142-
143- val isConditionDirectiveParentGroup =
144- parent.parentBlock?.let { grand ->
145- grand is SqlNewGroupBlock
146- } == true
147-
148- return isPrevBlockElseOrEnd || (hasNoChildrenExceptLast && isConditionDirectiveParentGroup)
139+ return isPrevBlockElseOrEnd || hasNoChildrenExceptLast
149140 }
150141
151142 private fun shouldSaveSpaceForNewGroup (parent : SqlNewGroupBlock ): Boolean {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ package org.domaframework.doma.intellij.formatter.block.group.keyword.condition
1717
1818import com.intellij.lang.ASTNode
1919import org.domaframework.doma.intellij.formatter.block.SqlBlock
20- import org.domaframework.doma.intellij.formatter.block.comment.SqlElConditionLoopCommentBlock
2120import org.domaframework.doma.intellij.formatter.block.group.keyword.SqlKeywordGroupBlock
2221import org.domaframework.doma.intellij.formatter.block.group.subgroup.SqlSubGroupBlock
2322import org.domaframework.doma.intellij.formatter.util.SqlBlockFormattingContext
@@ -46,15 +45,7 @@ class SqlConditionalExpressionGroupBlock(
4645 }
4746 }
4847
49- override fun createBlockIndentLen (): Int =
50- parentBlock?.let { parent ->
51- if (parent is SqlElConditionLoopCommentBlock ) {
52- parent.indent.groupIndentLen
53- } else {
54- parent.indent.groupIndentLen.plus(1 )
55- }
56- }
57- ? : offset
48+ override fun createBlockIndentLen (): Int = parentBlock?.indent?.groupIndentLen?.plus(1 ) ? : 1
5849
5950 override fun createGroupIndentLen (): Int = indent.indentLen.plus(1 )
6051}
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ abstract class SqlSubGroupBlock(
5050 SqlWithCommonTableGroupBlock ::class ,
5151 SqlWithColumnGroupBlock ::class ,
5252 SqlCreateViewGroupBlock ::class ,
53- SqlElConditionLoopCommentBlock ::class ,
5453 )
5554 }
5655
Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ import org.domaframework.doma.intellij.setting.SqlLanguage
2929
3030class SqlFormatPostProcessor : SqlPostProcessor () {
3131 override fun processElement (
32- source : PsiElement ,
32+ element : PsiElement ,
3333 settings : CodeStyleSettings ,
34- ): PsiElement = source
34+ ): PsiElement = element
3535
3636 override fun processText (
3737 source : PsiFile ,
You can’t perform that action at this time.
0 commit comments