diff --git a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target index e89bb3d0a4..b8c0d2fb99 100644 --- a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target +++ b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target @@ -31,7 +31,7 @@ - + diff --git a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java index 6e3ac5a23b..f563d7371b 100644 --- a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java +++ b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java @@ -1162,6 +1162,33 @@ public void testSnippet_ifelse2() throws JavaModelException { assertTrue(items.size() > 0); } + // https://github.com/eclipse/eclipse.jdt.ls/issues/1800 + @Test + public void testSnippet_if2() throws JavaModelException { + //@formatter:off + ICompilationUnit unit = getWorkingCopy( + "src/org/sample/Test.java", + "public class Test {\n" + + " private boolean flag;\n" + + " private void test(List c) {\n" + + " if (flag) {\n" + + " \n" + + " List scs = c.subList(0, 1);\n" + + " }\n" + + " }\n" + + " String test() {\n" + + " return null;\n" + + " } \n" + + "}" + ); + //@formatter:on + int[] loc = findCompletionLocation(unit, " "); + CompletionList list = server.completion(JsonMessageHelper.getParams(createCompletionRequest(unit, loc[0], loc[1]))).join().getRight(); + assertNotNull(list); + List items = new ArrayList<>(list.getItems()); + assertTrue(items.size() > 1); + } + @Test public void testSnippet_ifelse() throws JavaModelException { //@formatter:off