Skip to content

Commit 71349aa

Browse files
committed
fix db = dao.Xxx completion
1 parent 01e7aca commit 71349aa

File tree

1 file changed

+8
-1
lines changed
  • src/main/kotlin/com/github/oldmegit/goframehelper/callUtil/orm

1 file changed

+8
-1
lines changed

src/main/kotlin/com/github/oldmegit/goframehelper/callUtil/orm/OrmUtil.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.github.oldmegit.goframehelper.callUtil.orm
22

33
import com.github.oldmegit.goframehelper.callUtil.CallUtil
4-
import com.goide.parser.GoParser.ReferenceExpression
54
import com.goide.psi.*
65
import com.goide.psi.impl.GoPsiUtil
76
import com.intellij.psi.PsiComment
@@ -129,6 +128,14 @@ object OrmUtil : CallUtil() {
129128
// db = db.Xxx
130129
// db = dao.Xxx
131130
private fun doAssignmentStatement(assignmentStatement: GoAssignmentStatement): GoStatement? {
131+
// get GoReferenceExpression list
132+
for (one in assignmentStatement.expressionList) {
133+
// dao.Xxx
134+
// if statement contain dao
135+
if (one.text.startsWith("dao.")) {
136+
return assignmentStatement
137+
}
138+
}
132139
for (expression in assignmentStatement.leftHandExprList.expressionList) {
133140
val psiElementRoot = expression.reference?.resolve()
134141
return getStatementContainDao(psiElementRoot!!)

0 commit comments

Comments
 (0)