--- /dev/null
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.completion;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class CompletionPreselectionBehaviourProvider {
+ public static ExtensionPointName<CompletionPreselectionBehaviourProvider> EP_NAME = ExtensionPointName.create("com.intellij.completion.completionBehaviourProvider");
+
+ public boolean shouldPreselectFirstSuggestion(@NotNull CompletionParameters parameters) {
+ return true;
+ }
+}
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
return false;
}
+ if (Registry.is("ide.completion.lookup.element.preselect.depends.on.context")) {
+ for (CompletionPreselectionBehaviourProvider provider : Extensions.getExtensions(CompletionPreselectionBehaviourProvider.EP_NAME)) {
+ if (!provider.shouldPreselectFirstSuggestion(parameters)) {
+ return false;
+ }
+ }
+ }
+
if (!ApplicationManager.getApplication().isUnitTestMode()) {
return true;
}
<with attribute="implementationClass" implements="com.intellij.codeInsight.completion.CompletionConfidence"/>
</extensionPoint>
+ <extensionPoint name="completion.completionBehaviourProvider"
+ interface="com.intellij.codeInsight.completion.CompletionPreselectionBehaviourProvider"/>
+
<extensionPoint name="completion.skip" interface="com.intellij.codeInsight.completion.CompletionPreselectSkipper"/>
<extensionPoint name="lookup.charFilter" interface="com.intellij.codeInsight.lookup.CharFilter"/>
<extensionPoint name="lookup.actionProvider" interface="com.intellij.codeInsight.lookup.LookupActionProvider"/>
ide.completion.middle.matching=true
ide.completion.middle.matching.description=Suggest items in completion that contain the entered string somewhere in the middle.
+
+ide.completion.lookup.element.preselect.depends.on.context=true
+ide.completion.lookup.element.preselect.depends.on.context.description=Preselection of the first element in completion list depends on context
+
ide.goto.middle.matching=true
ide.goto.middle.matching.description=Suggest items in goto actions that contain the entered string somewhere in the middle.
ide.goto.rebuild.delay=0