mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-83722 Autopopup interferes after new in varargs
This commit is contained in:
@@ -128,11 +128,16 @@ public class JavaCharFilter extends CharFilter {
|
||||
|
||||
if (c == '[') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '<' && o instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '(' && o instanceof PsiClass) {
|
||||
if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.NEW).accepts(lookup.getPsiElement())) {
|
||||
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
if (c == '(') {
|
||||
if (o instanceof PsiClass) {
|
||||
if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.NEW).accepts(lookup.getPsiElement())) {
|
||||
return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
|
||||
}
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
if (o instanceof PsiType) {
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
if ((c == ',' || c == '=') && o instanceof PsiVariable) {
|
||||
int lookupStart = ((LookupImpl)lookup).getLookupStart();
|
||||
|
||||
@@ -1252,4 +1252,15 @@ class Foo {
|
||||
assert !lookup
|
||||
}
|
||||
|
||||
public void testVarargParenthesis() {
|
||||
myFixture.configureByText 'a.java', '''
|
||||
class Foo {
|
||||
void foo(File... files) { }
|
||||
{ foo(new <caret>) }
|
||||
}
|
||||
'''
|
||||
type 'File('
|
||||
assert myFixture.file.text.contains('new File()')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -268,5 +268,14 @@ class GroovyAutoPopupTest extends CompletionAutoPopupTestCase {
|
||||
assert myFixture.lookupElementStrings.containsAll(['too', 'command.toString'])
|
||||
}
|
||||
|
||||
public void testVarargParenthesis() {
|
||||
myFixture.configureByText 'a.groovy', '''
|
||||
void foo(File... files) { }
|
||||
foo(new <caret>)
|
||||
'''
|
||||
type 'File('
|
||||
assert myFixture.file.text.contains('new File()')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user