Skip to content

Commit 08f8fbb

Browse files
committed
fix: wrong trigger when user typing from code.
1 parent 8a8a672 commit 08f8fbb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/kotlin/cc/unitmesh/devti/practise/RenameLookupManagerListener.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import cc.unitmesh.devti.util.LLMCoroutineScope
88
import com.intellij.codeInsight.completion.PrefixMatcher
99
import com.intellij.codeInsight.lookup.*
1010
import com.intellij.codeInsight.lookup.impl.LookupImpl
11+
import com.intellij.codeInsight.template.TemplateManager
1112
import com.intellij.openapi.application.runInEdt
1213
import com.intellij.openapi.application.runReadAction
1314
import com.intellij.openapi.diagnostic.logger
@@ -36,6 +37,9 @@ class RenameLookupManagerListener(val project: Project) : LookupManagerListener
3637
// maybe user just typing, we should handle for this
3738
val originName = (targetElement as? PsiNameIdentifierOwner)?.name ?: return
3839

40+
// avoid user typing in template. only suggest that user refactor the name
41+
TemplateManager.getInstance(project).getActiveTemplate(editor) ?: return
42+
3943
if (originName.isBlank()) return
4044

4145
val promptText =

0 commit comments

Comments
 (0)