Skip to content

Commit 1c75e6e

Browse files
committed
Enhance DAO parameter suggestion logic in SqlCompletionOtherBlockProcessor
1 parent d7d243b commit 1c75e6e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/kotlin/org/domaframework/doma/intellij/contributor/sql/processor/SqlCompletionOtherBlockProcessor.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,24 @@ import com.intellij.psi.util.elementType
2222
import org.domaframework.doma.intellij.psi.SqlTypes
2323

2424
class SqlCompletionOtherBlockProcessor : SqlCompletionBlockProcessor() {
25+
/**
26+
* Generate a list of related elements for suggesting regular DAO argument parameters
27+
* and instance properties of field access elements.
28+
*
29+
* @param targetElement Element at the caret position.
30+
* @return List of preceding elements related to the caret position.
31+
*/
2532
override fun generateBlock(targetElement: PsiElement): List<PsiElement> {
33+
// When entering a new bind variable, an empty list is returned and element names defined as DAO argument parameters
34+
// or in loop directives are suggested.
2635
if (targetElement is PsiWhiteSpace &&
2736
targetElement.text.length > 1 &&
2837
PsiTreeUtil.prevLeaf(targetElement, true)?.elementType != SqlTypes.DOT
2938
) {
3039
return emptyList()
3140
}
3241

42+
// For SqlElFieldAccessExpr,this is the list from the top element to the element at the caret position.
3343
val prevElms = findSelfBlocks(targetElement)
3444
if (prevElms.isNotEmpty()) {
3545
return filterBlocks(prevElms)

0 commit comments

Comments
 (0)