@@ -20,7 +20,10 @@ import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase
2020import com.intellij.openapi.editor.Editor
2121import com.intellij.psi.PsiElement
2222import com.intellij.psi.PsiFile
23+ import com.intellij.psi.util.PsiTreeUtil
2324import com.intellij.util.Consumer
25+ import com.tang.intellij.lua.comment.psi.LuaDocReturnDef
26+ import com.tang.intellij.lua.comment.psi.api.LuaComment
2427import com.tang.intellij.lua.psi.*
2528
2629import java.util.Collections
@@ -29,7 +32,7 @@ import java.util.Collections
2932
3033 * Created by tangzx on 2017/3/18.
3134 */
32- class LuaHighlightExitPointsHandler internal constructor(editor : Editor , file : PsiFile , private val target : LuaReturnStat , private val funcBody : LuaFuncBody ? ) : HighlightUsagesHandlerBase<PsiElement>(editor, file) {
35+ class LuaHighlightExitPointsHandler internal constructor(editor : Editor , file : PsiFile , private val target : LuaReturnStat , private val funcBody : LuaFuncBody ) : HighlightUsagesHandlerBase<PsiElement>(editor, file) {
3336
3437 override fun getTargets (): List <PsiElement > {
3538 return listOf<PsiElement >(target)
@@ -40,7 +43,7 @@ class LuaHighlightExitPointsHandler internal constructor(editor: Editor, file: P
4043 }
4144
4245 override fun computeUsages (list : List <PsiElement >) {
43- funcBody? .acceptChildren(object : LuaVisitor () {
46+ funcBody.acceptChildren(object : LuaVisitor () {
4447 override fun visitReturnStat (o : LuaReturnStat ) {
4548 addOccurrence(o)
4649 }
@@ -57,5 +60,13 @@ class LuaHighlightExitPointsHandler internal constructor(editor: Editor, file: P
5760 o.acceptChildren(this )
5861 }
5962 })
63+
64+ val parent = funcBody.parent
65+ if (parent is LuaCommentOwner ) {
66+ val comment = parent.comment
67+ val returnDef = PsiTreeUtil .findChildOfType(comment, LuaDocReturnDef ::class .java)
68+ if (returnDef != null )
69+ addOccurrence(returnDef)
70+ }
6071 }
6172}
0 commit comments