mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-147313 Adding @NotNull in front of a method parameter and finishing lookup with Space inserts 2 spaces
This commit is contained in:
+7
-4
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.AutoPopupController;
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
import com.intellij.codeInsight.ExpectedTypesProvider;
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -112,10 +113,12 @@ class JavaClassNameInsertHandler implements InsertHandler<JavaPsiClassReferenceE
|
||||
if (shouldHaveAnnotationParameters(psiClass)) {
|
||||
JavaCompletionUtil.insertParentheses(context, item, false, true);
|
||||
}
|
||||
CharSequence text = context.getDocument().getCharsSequence();
|
||||
int tail = context.getTailOffset();
|
||||
if (text.length() > tail && Character.isLetter(text.charAt(tail))) {
|
||||
context.getDocument().insertString(tail, " ");
|
||||
if (context.getCompletionChar() == Lookup.NORMAL_SELECT_CHAR || context.getCompletionChar() == Lookup.COMPLETE_STATEMENT_SELECT_CHAR) {
|
||||
CharSequence text = context.getDocument().getCharsSequence();
|
||||
int tail = context.getTailOffset();
|
||||
if (text.length() > tail && Character.isLetter(text.charAt(tail))) {
|
||||
context.getDocument().insertString(tail, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
@interface AbcdAnno {}
|
||||
|
||||
class Foo {
|
||||
void foo(@Abc<caret>Foo f) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
@interface AbcdAnno {}
|
||||
|
||||
class Foo {
|
||||
void foo(@AbcdAnno <caret>Foo f) {}
|
||||
}
|
||||
+1
@@ -999,6 +999,7 @@ public class ListUtils {
|
||||
public void testOnlyAnnotationsAfterAt() throws Throwable { doTest() }
|
||||
public void testOnlyAnnotationsAfterAt2() throws Throwable { doTest('\n') }
|
||||
public void testAnnotationBeforeIdentifier() { doTest('\n') }
|
||||
public void testAnnotationBeforeIdentifierFinishWithSpace() { doTest(' ') }
|
||||
|
||||
public void testOnlyExceptionsInCatch1() throws Exception { doTest('\n') }
|
||||
public void testOnlyExceptionsInCatch2() throws Exception { doTest('\n') }
|
||||
|
||||
Reference in New Issue
Block a user