File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/main/java/com/tang/intellij/lua/comment/reference Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ package com.tang.intellij.lua.comment.reference
1919import com.intellij.openapi.util.TextRange
2020import com.intellij.psi.PsiElement
2121import com.intellij.psi.PsiReferenceBase
22+ import com.intellij.psi.util.PsiTreeUtil
2223import com.tang.intellij.lua.comment.psi.LuaDocClassNameRef
24+ import com.tang.intellij.lua.psi.LuaElementFactory
2325import com.tang.intellij.lua.search.LuaPredefinedScope
2426import com.tang.intellij.lua.stubs.index.LuaClassIndex
2527
@@ -35,6 +37,12 @@ class LuaClassNameReference(element: LuaDocClassNameRef) : PsiReferenceBase<LuaD
3537 return myElement.manager.areElementsEquivalent(element, resolve())
3638 }
3739
40+ override fun handleElementRename (newElementName : String ): PsiElement {
41+ val element = LuaElementFactory .createWith(myElement.project, " ---@type $newElementName " )
42+ val classNameRef = PsiTreeUtil .findChildOfType(element, LuaDocClassNameRef ::class .java)
43+ return myElement.replace(classNameRef!! )
44+ }
45+
3846 override fun resolve (): PsiElement ? {
3947 val name = myElement.text
4048 val defs = LuaClassIndex .getInstance().get(name, myElement.project, LuaPredefinedScope (myElement.project))
You can’t perform that action at this time.
0 commit comments