mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
respect the completion case sensitive first letter option back
This commit is contained in:
+1
-14
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
|
||||
import com.intellij.codeInsight.hint.ShowParameterInfoHandler;
|
||||
@@ -249,7 +248,6 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
if (reference instanceof PsiJavaReference) {
|
||||
final ElementFilter filter = getReferenceFilter(position);
|
||||
if (filter != null) {
|
||||
boolean showCapitalizedClasses = showCapitalizedClasses(result);
|
||||
final boolean isSwitchLabel = SWITCH_LABEL.accepts(position);
|
||||
final PsiFile originalFile = parameters.getOriginalFile();
|
||||
for (LookupElement element : JavaCompletionUtil.processJavaReference(position,
|
||||
@@ -261,12 +259,6 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!showCapitalizedClasses &&
|
||||
element.getObject() instanceof PsiClass &&
|
||||
StringUtil.isCapitalized(((PsiClass)element.getObject()).getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSwitchLabel) {
|
||||
result.addElement(TailTypeDecorator.withTail(element, TailType.createSimpleTailType(':')));
|
||||
}
|
||||
@@ -308,11 +300,6 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean showCapitalizedClasses(CompletionResultSet result) {
|
||||
String prefix = result.getPrefixMatcher().getPrefix();
|
||||
return StringUtil.isEmpty(prefix) || StringUtil.isCapitalized(prefix) || CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE == CodeInsightSettings.NONE;
|
||||
}
|
||||
|
||||
private static void addKeywords(CompletionParameters parameters, CompletionResultSet result) {
|
||||
PsiElement position = parameters.getPosition();
|
||||
final Set<LookupElement> lookupSet = new LinkedHashSet<LookupElement>();
|
||||
@@ -344,7 +331,7 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
return false;
|
||||
}
|
||||
|
||||
return StringUtil.isCapitalized(result.getPrefixMatcher().getPrefix());
|
||||
return StringUtil.isNotEmpty(result.getPrefixMatcher().getPrefix());
|
||||
}
|
||||
|
||||
private static void completeAnnotationAttributeName(CompletionResultSet result, PsiElement insertedElement,
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
public class Foo {
|
||||
|
||||
{
|
||||
aa<caret>
|
||||
}
|
||||
|
||||
}
|
||||
-7
@@ -48,13 +48,6 @@ public class HeavyNormalCompletionTest extends CompletionTestCase{
|
||||
checkResultByFile("/codeInsight/completion/normal/" + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testOnlyUppercaseClassesWhenNothingIsFound() throws Throwable {
|
||||
createClass("package foo.bar; public class aaaxBxCxDxEx {}");
|
||||
|
||||
configureByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java");
|
||||
checkResultByFile("/codeInsight/completion/normal/" + getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testAllClassesOnSecondBasicCompletion() throws Throwable {
|
||||
createClass("package foo.bar; public class AxBxCxDxEx {}");
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ public class NameUtil {
|
||||
}
|
||||
|
||||
public static Matcher buildCompletionMatcher(String pattern, int exactPrefixLen, boolean allowToUpper, boolean allowToLower) {
|
||||
return buildMatcher(pattern, buildRegexp(pattern, exactPrefixLen, allowToUpper, allowToLower, false, true), false);
|
||||
return buildMatcher(pattern, buildRegexp(pattern, exactPrefixLen, allowToUpper, allowToLower, false, true), exactPrefixLen > 0);
|
||||
}
|
||||
|
||||
public static Matcher buildMatcher(String pattern, int exactPrefixLen, boolean allowToUpper, boolean allowToLower) {
|
||||
|
||||
+1
-6
@@ -362,7 +362,6 @@ public class GroovyCompletionContributor extends CompletionContributor {
|
||||
|
||||
final ElementFilter classFilter = getClassFilter(position);
|
||||
|
||||
final boolean showCapitalizedClasses = JavaCompletionContributor.showCapitalizedClasses(result);
|
||||
reference.processVariants(new Consumer<Object>() {
|
||||
public void consume(Object element) {
|
||||
if (element instanceof PsiClass && inheritors.alreadyProcessed((PsiClass)element)) {
|
||||
@@ -384,10 +383,6 @@ public class GroovyCompletionContributor extends CompletionContributor {
|
||||
object = ((GroovyResolveResult)object).getElement();
|
||||
}
|
||||
|
||||
if (!showCapitalizedClasses && object instanceof PsiClass && StringUtil.isCapitalized(((PsiClass)object).getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean autopopup = parameters.getInvocationCount() == 0;
|
||||
//skip default groovy methods
|
||||
if (!secondCompletionInvoked &&
|
||||
@@ -458,7 +453,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
|
||||
}
|
||||
});
|
||||
|
||||
if (StringUtil.isCapitalized(prefix)) {
|
||||
if (StringUtil.isNotEmpty(result.getPrefixMatcher().getPrefix())) {
|
||||
addAllClasses(parameters, result, inheritors);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user