From d2435d60197ff5c46acc713a09ca09a413b156d9 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 29 Aug 2011 19:20:12 +0200 Subject: [PATCH] insert common prefix by default, but only for explicit completion (for now) --- .../codeInsight/completion/NormalCompletionTest.groovy | 2 +- .../src/com/intellij/codeInsight/CodeInsightSettings.java | 2 +- .../codeInsight/completion/CodeCompletionHandlerBase.java | 2 -- .../com/intellij/codeInsight/completion/CompletionPhase.java | 4 ++++ 4 files changed, 6 insertions(+), 4 deletions(-) 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 f30dbcec0d3e..8cbfcc166175 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -749,7 +749,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase { checkResultByFile(getTestName(false) + "_after.java") } - public void _testSecondInvocationToFillCommonPrefix() throws Throwable { + public void testSecondInvocationToFillCommonPrefix() throws Throwable { configure() type('a'); complete(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java index 59b6fe780a71..e082d3389f2a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java @@ -92,7 +92,7 @@ public class CodeInsightSettings implements PersistentStateComponent, C public boolean AUTOCOMPLETE_ON_CODE_COMPLETION = true; public boolean AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = true; public boolean AUTOCOMPLETE_ON_CLASS_NAME_COMPLETION = false; - public boolean AUTOCOMPLETE_COMMON_PREFIX = false; + public boolean AUTOCOMPLETE_COMMON_PREFIX = true; public boolean SHOW_STATIC_AFTER_INSTANCE = false; public boolean SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO = false; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index dcffc9bccef5..bece8b7e45f6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -138,11 +138,9 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { CompletionPhase phase = CompletionServiceImpl.getCompletionPhase(); boolean repeated = phase.indicator != null && phase.indicator.isRepeatedInvocation(myCompletionType, editor); - /* if (repeated && isAutocompleteCommonPrefixOnInvocation() && phase.fillInCommonPrefix()) { return; } - */ if (invokedExplicitly) { time = phase.newCompletionStarted(time, repeated); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java index 622329112a1a..db6234cd7ccb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.java @@ -185,6 +185,10 @@ public abstract class CompletionPhase implements Disposable { @Override public boolean fillInCommonPrefix() { + if (indicator.isAutopopupCompletion()) { + return false; + } + return indicator.fillInCommonPrefix(true); } }