You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/kotlin/cc/unitmesh/devti/practise/RenameLookupManagerListener.kt
+5-8Lines changed: 5 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -30,18 +30,15 @@ class RenameLookupManagerListener(val project: Project) : LookupManagerListener
30
30
31
31
val lookupImpl = newLookup as?LookupImpl?:return
32
32
val editor = lookupImpl.editor as?EditorEx?:return
33
-
34
-
val targetElement:PsiElement?= lookupElement(lookupImpl, editor)
33
+
val targetElement:PsiElement= lookupElement(lookupImpl, editor) ?:return
35
34
36
35
// maybe user just typing, we should handle for this
37
-
val element = targetElement ?:return
38
-
val originName = (element as?PsiNameIdentifierOwner)?.name ?:return
36
+
val originName = (targetElement as?PsiNameIdentifierOwner)?.name ?:return
39
37
40
38
if (originName.isBlank()) return
41
39
42
40
val promptText =
43
-
"$originName is a badname. Please provide 5 better options name for follow code: \n```${element.language.displayName}\n${element.text}\n```\n\n1."
44
-
41
+
"$originName is a badname. Please provide 5 better options name for follow code: \n```${targetElement.language.displayName}\n${targetElement.text}\n```\n\n1."
45
42
46
43
try {
47
44
doExecuteNameSuggest(promptText, lookupImpl)
@@ -77,14 +74,13 @@ class RenameLookupManagerListener(val project: Project) : LookupManagerListener
77
74
78
75
runInEdt {
79
76
if (!lookupImpl.isLookupDisposed) {
80
-
logger.info("refreshUi for RenameLookupManagerListener")
0 commit comments