diff --git a/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab.java b/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab.java new file mode 100644 index 000000000000..ee788e7860d6 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab.java @@ -0,0 +1,7 @@ +class Xxx { + { + int iteraaa; + int iterbbb; + iter + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab_after.java b/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab_after.java new file mode 100644 index 000000000000..2e1d704ae47c --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/normal/LiveTemplatePrefixTab_after.java @@ -0,0 +1,7 @@ +class Xxx { + { + int iteraaa; + int iterbbb; + iteraaa + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy index b5659849377b..ab0b512dd486 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -803,17 +803,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { checkResult(); } - public void testClassNameWithInnersTab() throws Throwable { - configure() - myFixture.type '\t' - checkResult(); - } + public void testClassNameWithInnersTab() throws Throwable { doTest('\t') } - public void testClassNameWithGenericsTab() throws Throwable { - configure() - myFixture.type '\t' - checkResult(); - } + public void testClassNameWithGenericsTab() throws Throwable {doTest('\t') } + + public void testLiveTemplatePrefixTab() throws Throwable {doTest('\t') } public void testRightShift() throws Throwable { configure() diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemReplaceAction.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemReplaceAction.java index 43efa2b38b8c..84530c59b79b 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemReplaceAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemReplaceAction.java @@ -17,6 +17,8 @@ package com.intellij.codeInsight.lookup.impl.actions; import com.intellij.codeInsight.completion.CodeCompletionFeatures; +import com.intellij.codeInsight.completion.CompletionProcess; +import com.intellij.codeInsight.completion.CompletionService; import com.intellij.codeInsight.completion.CompletionUtil; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.LookupManager; @@ -49,7 +51,8 @@ public class ChooseItemReplaceAction extends EditorAction { public boolean isEnabled(Editor editor, DataContext dataContext) { LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor); if (lookup != null) { - if (hasTemplatePrefix(lookup, TemplateSettings.TAB_CHAR)) { + CompletionProcess completion = CompletionService.getCompletionService().getCurrentCompletion(); + if (completion != null && completion.isAutopopupCompletion() && hasTemplatePrefix(lookup, TemplateSettings.TAB_CHAR)) { return false; }