mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Java. Code completion] IDEA-379116 Support extracting variable via command completion inside generic type parameter
- Disable introduce local variable from command completion for kotlin GitOrigin-RevId: 407b51015d44bb1b26a551539ece62d1063c1aab
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c84d4436b8
commit
d80f26624d
+4
@@ -440,5 +440,9 @@
|
||||
<bundleName>messages.KotlinBundle</bundleName>
|
||||
<categoryKey>group.names.kotlin</categoryKey>
|
||||
</intentionAction>
|
||||
|
||||
<codeInsight.completion.intention.skipper
|
||||
implementationClass="org.jetbrains.kotlin.idea.codeInsight.intentions.shared.KotlinIntentionCommandSkipper"
|
||||
language="kotlin"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.codeInsight.intentions.shared
|
||||
|
||||
import com.intellij.codeInsight.completion.command.commands.IntentionCommandSkipper
|
||||
import com.intellij.codeInsight.intention.CommonIntentionAction
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.codeInsight.intention.IntentionActionDelegate
|
||||
import com.intellij.psi.PsiFile
|
||||
|
||||
class KotlinIntentionCommandSkipper : IntentionCommandSkipper {
|
||||
override fun skip(action: CommonIntentionAction, psiFile: PsiFile, offset: Int): Boolean {
|
||||
if (action !is IntentionAction) return false
|
||||
val unwrappedIntentionAction = IntentionActionDelegate.unwrap(action)
|
||||
return unwrappedIntentionAction is IntroduceVariableIntention
|
||||
}
|
||||
}
|
||||
+1
@@ -594,6 +594,7 @@ class K2CommandCompletionTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
)
|
||||
|
||||
val elements = myFixture.completeBasic()
|
||||
assertNull(elements.firstOrNull { element -> element.lookupString.contains("Introduce local variable", ignoreCase = true) })
|
||||
selectItem(elements.first { element -> element.lookupString.contains("Introduce variable", ignoreCase = true) })
|
||||
NonBlockingReadActionImpl.waitForAsyncTaskCompletion()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user