File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
src/main/kotlin/org/domaframework/doma/intellij
contributor/sql/processor Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,7 @@ class ForDirectiveUtil {
434434 completeResult = null ,
435435 validationResult = null ,
436436 )
437- val parametersExpr = PsiTreeUtil .nextLeaf( topElement)?.parent as ? SqlElParameters
437+ val parametersExpr = topElement.nextSibling as ? SqlElParameters
438438 if (parametersExpr == null ) {
439439 val topPropertyField = referenceClazz.findStaticField(searchText)
440440
Original file line number Diff line number Diff line change @@ -50,13 +50,20 @@ abstract class SqlCompletionBlockProcessor {
5050 }.toList()
5151
5252 var inParameter = false
53+ val rightLists: MutableList <PsiElement > = mutableListOf ()
5354 val formatElements = mutableListOf<PsiElement >()
5455 prevElements.forEach { prev ->
55- if (prev.elementType == SqlTypes .RIGHT_PAREN ) inParameter = true
56- if (! inParameter) {
56+ if (prev.elementType == SqlTypes .RIGHT_PAREN ) {
57+ inParameter = true
58+ rightLists.add(prev)
59+ }
60+ if (! inParameter && rightLists.isEmpty()) {
5761 formatElements.add(prev)
5862 }
59- if (prev.elementType == SqlTypes .LEFT_PAREN ) inParameter = false
63+ if (prev.elementType == SqlTypes .LEFT_PAREN ) {
64+ inParameter = false
65+ rightLists.removeLastOrNull()
66+ }
6067 }
6168
6269 val filterElements =
@@ -72,7 +79,7 @@ abstract class SqlCompletionBlockProcessor {
7279 }.plus(targetElement)
7380 .sortedBy { it.textOffset }
7481
75- return if ( filterElements.isNotEmpty()) filterElements else emptyList()
82+ return filterElements.ifEmpty { emptyList() }
7683 }
7784
7885 private fun isSqlElSymbol (element : PsiElement ): Boolean =
You can’t perform that action at this time.
0 commit comments