mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-75502 Tab in completion replaces the whole line instead of an identifier
This commit is contained in:
@@ -110,7 +110,13 @@ public class SmartCompletionDecorator extends TailTypeDecorator<LookupElement> {
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
if (getObject() instanceof PsiVariable && context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) {
|
||||
context.commitDocument();
|
||||
DefaultInsertHandler.removeEndOfIdentifier(context);
|
||||
context.commitDocument();
|
||||
}
|
||||
myPosition = getPosition(context, this);
|
||||
|
||||
super.handleInsert(context);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,6 @@ public class VariableLookupItem extends LookupItem<PsiVariable> implements Typed
|
||||
|
||||
context.getDocument().replaceString(context.getStartOffset(), context.getTailOffset(), variable.getName());
|
||||
context.commitDocument();
|
||||
if (context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) {
|
||||
DefaultInsertHandler.removeEndOfIdentifier(context);
|
||||
context.commitDocument();
|
||||
}
|
||||
|
||||
if (variable instanceof PsiField) {
|
||||
if (willBeImported()) {
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void foo() {
|
||||
Object textIndex = null;
|
||||
Object p = tI<caret>equals(2);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Foo {
|
||||
void foo() {
|
||||
Object textIndex = null;
|
||||
Object p = textIndex<caret>(2);
|
||||
}
|
||||
}
|
||||
+1
@@ -864,6 +864,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
assertEquals("fzazzz", list.get(1).getLookupString());
|
||||
}
|
||||
|
||||
public void testTabReplacesMethodNameWithLocalVariableName() throws Throwable { doTest('\t'); }
|
||||
public void testMethodParameterAnnotationClass() throws Throwable { doTest(); }
|
||||
public void testPrimitiveCastOverwrite() throws Throwable { doTest '\t' }
|
||||
public void testClassReferenceInFor() throws Throwable { doTest ' ' }
|
||||
|
||||
Reference in New Issue
Block a user