finishing completion with [ (IDEA-40461)

This commit is contained in:
peter
2011-03-08 18:00:37 +01:00
parent 24b5e9a888
commit 435b14a0ad
11 changed files with 61 additions and 8 deletions
@@ -210,7 +210,6 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
case '<':
case '>':
case '\"':
case '[': return TailType.createSimpleTailType(completionChar);
}
final TailType attr = item.getTailType();
return attr == TailType.UNKNOWN ? TailType.NONE : attr;
@@ -59,6 +59,7 @@ public class JavaCharFilter extends CharFilter {
}
}
if (c == '.' && isWithinLiteral(lookup)) return Result.ADD_TO_PREFIX;
if (c == '[') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP;
if (c == '#' && PsiTreeUtil.getParentOfType(lookup.getPsiElement(), PsiDocComment.class) != null) {
final LookupElement item = lookup.getCurrentItem();
@@ -0,0 +1,6 @@
class AbcdClass {}
class AbcdeClass {}
class Foo {
Abcd<caret>
}
@@ -0,0 +1,6 @@
class AbcdClass {}
class AbcdeClass {}
class Foo {
AbcdClass[<caret>]
}
@@ -0,0 +1,9 @@
class Foo {
int[] aaaa(int x){}
int[] aaab(){}
{
aaa<caret>
}
}
@@ -0,0 +1,9 @@
class Foo {
int[] aaaa(int x){}
int[] aaab(){}
{
aaaa()[<caret>]
}
}
@@ -0,0 +1,5 @@
class Foo {
d<caret>
class doz {}
}
@@ -0,0 +1,5 @@
class Foo {
double[<caret>]
class doz {}
}
@@ -0,0 +1,7 @@
class Foo {
{
int[] aaaa;
int[] aaab;
aa<caret>
}
}
@@ -0,0 +1,7 @@
class Foo {
{
int[] aaaa;
int[] aaab;
aaaa[<caret>]
}
}
@@ -569,13 +569,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
configureByFile(getTestName(false) + ".java");
final int parametersCount = ((PsiMethod)getLookup().getCurrentItem().getObject()).getParameterList().getParametersCount();
assertEquals(0, parametersCount);
new WriteCommandAction.Simple(getProject(), new PsiFile[0]) {
@Override
protected void run() throws Throwable {
getLookup().finishLookup(Lookup.NORMAL_SELECT_CHAR);
}
}.execute().throwException();
type '\n'
checkResult()
}
@@ -834,6 +828,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
public void testCommaAfterVariable() throws Throwable { doTest(',') }
public void testClassSquareBracket() throws Throwable { doTest('[') }
public void testPrimitiveSquareBracket() throws Throwable { doTest('[') }
public void testVariableSquareBracket() throws Throwable { doTest('[') }
public void testMethodSquareBracket() throws Throwable { doTest('[') }
public void testSuperProtectedMethod() throws Throwable {
myFixture.addClass """package foo;
public class Bar {