mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 21:41:24 +07:00
IDEA-102817 Accept completion variants by closing parentheses/brackets
This commit is contained in:
@@ -76,7 +76,7 @@ public class JavaCharFilter extends CharFilter {
|
||||
}
|
||||
|
||||
|
||||
if (c == '[') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '[' || c == ']' || c == ')' || c == '>') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '<' && o instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '(') {
|
||||
if (o instanceof PsiClass) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Bar {
|
||||
int foo(Object o1, Object o2) {
|
||||
return equals(o<caret>)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Bar {
|
||||
int foo(Object o1, Object o2) {
|
||||
return equals(o1)<caret>
|
||||
}
|
||||
}
|
||||
@@ -1126,6 +1126,8 @@ public class ListUtils {
|
||||
public void testMethodColon() throws Exception { doTest(':') }
|
||||
public void testVariableColon() throws Exception { doTest(':') }
|
||||
|
||||
public void testFinishByClosingParenthesis() throws Exception { doTest(')') }
|
||||
|
||||
public void testNoMethodsInParameterType() {
|
||||
configure()
|
||||
assertFirstStringItems "final", "float"
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.JavaCharFilter;
|
||||
import com.intellij.codeInsight.lookup.CharFilter;
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.patterns.StandardPatterns;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -72,7 +70,7 @@ public class GroovyReferenceCharFilter extends CharFilter {
|
||||
}
|
||||
|
||||
|
||||
if (c == '[') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '[' || c == ']' || c == ')' || c == '>') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '<' && item.getObject() instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '(' && PsiKeyword.RETURN.equals(item.getLookupString())) {
|
||||
return Result.HIDE_LOOKUP;
|
||||
|
||||
@@ -641,6 +641,10 @@ class A {
|
||||
myFixture.checkResult "List<String> l = new ArrayList<>(<caret>)"
|
||||
}
|
||||
|
||||
public void testFinishByClosingBracket() {
|
||||
doCompletionTest "int o1, o2; array[o<caret>", "int o1, o2; array[o1]<caret>", "]", CompletionType.BASIC
|
||||
}
|
||||
|
||||
public void testAfterNewWithInner() {
|
||||
myFixture.addClass """class Zzoo {
|
||||
static class Impl {}
|
||||
|
||||
Reference in New Issue
Block a user