Skip to content

Commit 4a6f917

Browse files
0dinDfbricon
authored andcommitted
Add space to anonymous type proposal
Signed-off-by: 0dinD <[email protected]>
1 parent 4e8a1eb commit 4a6f917

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/contentassist/AnonymousTypeCompletionProposal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public String updateReplacementString(IDocument document, int offset) throws Cor
4949
// See https://github.com/microsoft/language-server-protocol/issues/1032#issuecomment-648748013
5050
String newBody = fSnippetSupport ? "{\n\t${0}\n}" : "{\n\n}";
5151

52-
StringBuilder buf = new StringBuilder("new A()"); //$NON-NLS-1$
52+
StringBuilder buf = new StringBuilder("new A() "); //$NON-NLS-1$
5353
buf.append(newBody);
5454
// use the code formatter
5555
String lineDelim = TextUtilities.getDefaultLineDelimiter(document);

org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ public void testCompletion_AnonymousType() throws Exception {
19701970
assertEquals("java.Foo.IFoo", ci.getDetail());
19711971
assertEquals("999998684", ci.getSortText());
19721972
assertNotNull(ci.getTextEdit().getLeft());
1973-
assertTextEdit(2, 23, 23, "IFoo(){\n" +
1973+
assertTextEdit(2, 23, 23, "IFoo() {\n" +
19741974
" ${0}\n" +
19751975
"};", ci.getTextEdit().getLeft());
19761976
}
@@ -2000,7 +2000,7 @@ public void testCompletion_AnonymousTypeMoreMethods() throws Exception {
20002000
assertEquals(CompletionItemKind.Constructor, ci.getKind());
20012001
assertEquals("999998684", ci.getSortText());
20022002
assertNotNull(ci.getTextEdit().getLeft());
2003-
assertTextEdit(2, 23, 23, "IFoo(){\n" +
2003+
assertTextEdit(2, 23, 23, "IFoo() {\n" +
20042004
" ${0}\n" +
20052005
"};", ci.getTextEdit().getLeft());
20062006
}
@@ -2026,7 +2026,7 @@ public void testCompletion_AnonymousDeclarationType() throws Exception {
20262026
assertEquals(CompletionItemKind.Class, ci.getKind());
20272027
assertEquals("999999372", ci.getSortText());
20282028
assertNotNull(ci.getTextEdit().getLeft());
2029-
assertTextEdit(2, 20, 22, "(){\n" +
2029+
assertTextEdit(2, 20, 22, "() {\n" +
20302030
" ${0}\n" +
20312031
"}", ci.getTextEdit().getLeft());
20322032
}
@@ -2052,7 +2052,7 @@ public void testCompletion_AnonymousDeclarationType2() throws Exception {
20522052
assertEquals(CompletionItemKind.Class, ci.getKind());
20532053
assertEquals("999999372", ci.getSortText());
20542054
assertNotNull(ci.getTextEdit().getLeft());
2055-
assertTextEdit(2, 20, 24, "(){\n" +
2055+
assertTextEdit(2, 20, 24, "() {\n" +
20562056
" ${0}\n" +
20572057
"}", ci.getTextEdit().getLeft());
20582058
}
@@ -2080,7 +2080,7 @@ public void testCompletion_AnonymousDeclarationType3() throws Exception {
20802080
assertEquals(CompletionItemKind.Class, ci.getKind());
20812081
assertEquals("999999372", ci.getSortText());
20822082
assertNotNull(ci.getTextEdit().getLeft());
2083-
assertTextEdit(2, 33, 37, "(){\n" +
2083+
assertTextEdit(2, 33, 37, "() {\n" +
20842084
" ${0}\n" +
20852085
"}", ci.getTextEdit().getLeft());
20862086
}
@@ -2109,7 +2109,7 @@ public void testCompletion_AnonymousDeclarationType4() throws Exception {
21092109
assertEquals(CompletionItemKind.Class, ci.getKind());
21102110
assertEquals("999999372", ci.getSortText());
21112111
assertNotNull(ci.getTextEdit().getLeft());
2112-
assertTextEdit(3, 8, 12, "(){\n" +
2112+
assertTextEdit(3, 8, 12, "() {\n" +
21132113
" ${0}\n" +
21142114
"}", ci.getTextEdit().getLeft());
21152115
}
@@ -2133,7 +2133,7 @@ public void testCompletion_AnonymousDeclarationType5() throws Exception {
21332133
assertEquals(CompletionItemKind.Class, ci.getKind());
21342134
assertEquals("999999372", ci.getSortText());
21352135
assertNotNull(ci.getTextEdit().getLeft());
2136-
assertTextEdit(2, 33, 33, "(){\n" +
2136+
assertTextEdit(2, 33, 33, "() {\n" +
21372137
" ${0}\n" +
21382138
"}", ci.getTextEdit().getLeft());
21392139
}

0 commit comments

Comments
 (0)