File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
src/main/kotlin/org/domaframework/doma/intellij/formatter/block Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ open class SqlRightPatternBlock(
5757 */
5858 private fun enableLastRight () {
5959 parentBlock?.let { parent ->
60- // TODO:Customize spacing
60+ // Check if parent is in the notInsertSpaceClassList
6161 val notInsertSpaceClassList =
6262 listOf (
6363 SqlFunctionParamBlock ::class ,
@@ -70,30 +70,25 @@ open class SqlRightPatternBlock(
7070 return
7171 }
7272
73+ // Check if parent is SqlSubQueryGroupBlock
7374 if (parent is SqlSubQueryGroupBlock ) {
74- val prevKeywordBlocks =
75+ val prevKeywordBlock =
7576 parent.childBlocks
7677 .filter { it.node.startOffset < node.startOffset }
7778 .find { it is SqlKeywordGroupBlock }
7879
79- when (prevKeywordBlocks?.indent?.indentLevel) {
80- IndentType .TOP -> {
81- preSpaceRight = true
82- return
83- }
84-
85- else -> {
86- preSpaceRight = false
87- return
88- }
89- }
80+ preSpaceRight = prevKeywordBlock?.indent?.indentLevel == IndentType .TOP
81+ return
9082 }
9183
92- parent.parentBlock?.let { grand ->
93- preSpaceRight = grand.childBlocks.find { it is SqlKeywordGroupBlock } != null
84+ // Check grandparent for SqlKeywordGroupBlock
85+ parent.parentBlock?.let { grandParent ->
86+ preSpaceRight = grandParent.childBlocks.any { it is SqlKeywordGroupBlock }
9487 return
9588 }
9689 }
90+
91+ // Default case
9792 preSpaceRight = false
9893 }
9994
You can’t perform that action at this time.
0 commit comments