mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
suppress postfix templates [r=ignatov]
This commit is contained in:
committed by
Sergey Ignatov
parent
3d258b9e25
commit
edb1f6b86f
+8
@@ -0,0 +1,8 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().inst<caret>
|
||||
new Object().inst<caret>
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().inst<caret>
|
||||
new Object().inst<caret>
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
class A {
|
||||
Object foo;
|
||||
Object bar;
|
||||
|
||||
public static void main(String[] args) {
|
||||
foo == null<caret>
|
||||
|
||||
bar<caret>
|
||||
|
||||
bar == null<caret>
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
class A {
|
||||
Object foo;
|
||||
Object bar;
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (foo == null) {
|
||||
|
||||
}
|
||||
|
||||
bar.if
|
||||
|
||||
if (bar == null) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
Object foo;
|
||||
Object bar;
|
||||
|
||||
public static void main(String[] args) {
|
||||
foo == null<caret>
|
||||
bar == null<caret>
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
Object foo;
|
||||
Object bar;
|
||||
|
||||
public static void main(String[] args) {
|
||||
foo == null.if <caret>
|
||||
bar == null.if <caret>
|
||||
}
|
||||
}
|
||||
+26
-4
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.template.postfix.completion;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.completion.CompletionAutoPopupTestCase;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor;
|
||||
@@ -27,10 +28,18 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
|
||||
private boolean shotTemplatesInTestsOldValue;
|
||||
|
||||
@Override
|
||||
public void setUp() {
|
||||
super.setUp();
|
||||
shotTemplatesInTestsOldValue = LiveTemplateCompletionContributor.ourShowTemplatesInTests;
|
||||
LiveTemplateCompletionContributor.ourShowTemplatesInTests = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
LiveTemplateCompletionContributor.ourShowTemplatesInTests = false;
|
||||
LiveTemplateCompletionContributor.ourShowTemplatesInTests = shotTemplatesInTestsOldValue;
|
||||
|
||||
PostfixTemplatesSettings settings = PostfixTemplatesSettings.getInstance();
|
||||
assertNotNull(settings);
|
||||
@@ -95,6 +104,17 @@ public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
|
||||
doAutoPopupTest("instanceof", null);
|
||||
}
|
||||
|
||||
public void testDoNotShowTemplateInMultiCaretMode() {
|
||||
doAutoPopupTest("instanceof", null);
|
||||
}
|
||||
|
||||
public void testDoNotCompleteTemplateInMultiCaretMode() {
|
||||
LiveTemplateCompletionContributor.ourShowTemplatesInTests = true;
|
||||
configureByFile();
|
||||
assertEmpty(myFixture.complete(CompletionType.BASIC));
|
||||
checkResultByFile();
|
||||
}
|
||||
|
||||
public void testShowTemplateOnDoubleLiteral() {
|
||||
doAutoPopupTest("switch", SwitchStatementPostfixTemplate.class);
|
||||
}
|
||||
@@ -146,7 +166,7 @@ public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
|
||||
|
||||
public void testTabCompletionWithTemplatesInAutopopup() {
|
||||
LiveTemplateCompletionContributor.ourShowTemplatesInTests = true;
|
||||
|
||||
|
||||
configureByFile();
|
||||
type(".");
|
||||
myFixture.assertPreferredCompletionItems(0, "parents");
|
||||
@@ -156,8 +176,10 @@ public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
|
||||
checkResultByFile();
|
||||
}
|
||||
|
||||
public void testMultiCaret() {
|
||||
doCompleteTest(".if", '\t');
|
||||
public void testShouldNotExpandInMultiCaretMode() {
|
||||
configureByFile();
|
||||
type(".if\t");
|
||||
checkResultByFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user