mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IDEA-173473 Class type argument brackets are still inserted despite that being disabled
This commit is contained in:
@@ -885,7 +885,9 @@ public class JavaCompletionUtil {
|
||||
String open = escapeXmlIfNeeded(context, "<");
|
||||
context.getDocument().insertString(offset, open);
|
||||
context.getEditor().getCaretModel().moveToOffset(offset + open.length());
|
||||
context.getDocument().insertString(offset + open.length(), escapeXmlIfNeeded(context, ">"));
|
||||
if (CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) {
|
||||
context.getDocument().insertString(offset + open.length(), escapeXmlIfNeeded(context, ">"));
|
||||
}
|
||||
if (context.getCompletionChar() != Lookup.COMPLETE_STATEMENT_SELECT_CHAR) {
|
||||
context.setAddCompletionChar(false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
public class SomeClass {
|
||||
private void b() {
|
||||
List<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
|
||||
public class SomeClass {
|
||||
private void b() {
|
||||
List<<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +222,7 @@ class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
protected void tearDown() throws Exception {
|
||||
CodeInsightSettings.instance.AUTOCOMPLETE_ON_CODE_COMPLETION = true
|
||||
CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.FIRST_LETTER
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = true
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
@@ -361,44 +362,22 @@ class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
}
|
||||
|
||||
void testMethodWithLeftParTailTypeNoPairBrace() throws Exception {
|
||||
final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false
|
||||
|
||||
try {
|
||||
configureByFile(getTestName(false) + ".java")
|
||||
type('(')
|
||||
checkResult()
|
||||
}
|
||||
finally {
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = old
|
||||
}
|
||||
doTest('(')
|
||||
}
|
||||
|
||||
void testMethodWithLeftParTailTypeNoPairBrace2() throws Exception {
|
||||
final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false
|
||||
|
||||
try {
|
||||
//no tail type should work the normal way
|
||||
configureByFile("MethodWithLeftParTailTypeNoPairBrace.java")
|
||||
selectItem(myItems[0])
|
||||
checkResultByFile("MethodWithLeftParTailTypeNoPairBrace_after2.java")
|
||||
}
|
||||
finally {
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = old
|
||||
}
|
||||
//no tail type should work the normal way
|
||||
configureByFile("MethodWithLeftParTailTypeNoPairBrace.java")
|
||||
selectItem(myItems[0])
|
||||
checkResultByFile("MethodWithLeftParTailTypeNoPairBrace_after2.java")
|
||||
}
|
||||
|
||||
void testMethodNoPairBrace() throws Exception {
|
||||
final boolean old = CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = false
|
||||
|
||||
try {
|
||||
doTest '\n'
|
||||
}
|
||||
finally {
|
||||
CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET = old
|
||||
}
|
||||
doTest '\n'
|
||||
}
|
||||
|
||||
void testExcessSpaceInTypeCast() throws Throwable {
|
||||
@@ -1784,5 +1763,10 @@ class Bar {
|
||||
myFixture.addClass("package pkg; public class PathUtil { public static String toSystemDependentName() {} }")
|
||||
doTest('\n')
|
||||
}
|
||||
|
||||
void testPairAngleBracketDisabled() {
|
||||
CodeInsightSettings.instance.AUTOINSERT_PAIR_BRACKET = false
|
||||
doTest('<')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user