mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-51529 Space isn't inserted when completion is finished by '=' symbol
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
@@ -27,4 +29,13 @@ public class VariableLookupItem extends LookupItem<PsiVariable> implements Typed
|
||||
setAttribute(SUBSTITUTOR, substitutor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
super.handleInsert(context);
|
||||
|
||||
if (context.getCompletionChar() == '=') {
|
||||
context.setAddCompletionChar(false);
|
||||
TailType.EQ.processTail(context.getEditor(), context.getTailOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class B {
|
||||
void m() {
|
||||
int xxx = 0;
|
||||
int xxy = 0;
|
||||
xx<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class B {
|
||||
void m() {
|
||||
int xxx = 0;
|
||||
int xxy = 0;
|
||||
xxx = <caret>
|
||||
}
|
||||
}
|
||||
+2
@@ -546,6 +546,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testNothingAfterNumericLiteral() throws Throwable { doAntiTest(); }
|
||||
|
||||
public void testSpacesAroundEq() throws Throwable { doTest('='); }
|
||||
|
||||
public void testNoAllClassesOnQualifiedReference() throws Throwable {
|
||||
configureByFile(getTestName(false) + ".java");
|
||||
assertEmpty(myItems);
|
||||
|
||||
+6
@@ -140,6 +140,12 @@ public class GroovyInsertHandler implements InsertHandler<LookupElement> {
|
||||
}
|
||||
}
|
||||
|
||||
if (context.getCompletionChar() == '=') {
|
||||
context.setAddCompletionChar(false);
|
||||
TailType.EQ.processTail(context.getEditor(), context.getTailOffset());
|
||||
return;
|
||||
}
|
||||
|
||||
addTailType(item).processTail(context.getEditor(), context.getTailOffset());
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -400,4 +400,11 @@ format<caret>"""
|
||||
myFixture.checkResult "def b<caret>"
|
||||
}
|
||||
|
||||
public void testSpacesAroundEq() {
|
||||
myFixture.configureByText "a.groovy", "int xxx, xxy; xx<caret>"
|
||||
myFixture.completeBasic()
|
||||
myFixture.type '='
|
||||
myFixture.checkResult "int xxx, xxy; xxx = <caret>"
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user