diff options
author | George Fraser <george@fivetran.com> | 2018-06-21 17:06:46 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-06-21 17:06:46 -0700 |
commit | 683d91259b10c898bd570cba0d3bad15101548b8 (patch) | |
tree | 66ea045ba8ff04a18fd8a11e5e9ec53d06619ea1 /src/test | |
parent | 1716586fad1372aaeadaab358c320b2dc4e32b77 (diff) | |
download | java-language-server-683d91259b10c898bd570cba0d3bad15101548b8.zip |
Active method and parameter
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/javacs/CompletionsBase.java | 13 | ||||
-rw-r--r-- | src/test/java/org/javacs/JavaCompilerServiceTest.java | 7 | ||||
-rw-r--r-- | src/test/java/org/javacs/SymbolUnderCursorTest.java | 1 |
3 files changed, 10 insertions, 11 deletions
diff --git a/src/test/java/org/javacs/CompletionsBase.java b/src/test/java/org/javacs/CompletionsBase.java index 7e2629d..e981224 100644 --- a/src/test/java/org/javacs/CompletionsBase.java +++ b/src/test/java/org/javacs/CompletionsBase.java @@ -10,10 +10,7 @@ import java.util.concurrent.ExecutionException; import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.eclipse.lsp4j.CompletionItem; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.lsp4j.TextDocumentPositionParams; +import org.eclipse.lsp4j.*; public class CompletionsBase { protected static final Logger LOG = Logger.getLogger("main"); @@ -72,7 +69,8 @@ public class CompletionsBase { return items.stream() .flatMap( i -> { - if (i.getDocumentation() != null) return Stream.of(i.getDocumentation().trim()); + if (i.getDocumentation() != null) + return Stream.of(i.getDocumentation().getRight().getValue().trim()); else return Stream.empty(); }) .collect(Collectors.toSet()); @@ -82,9 +80,8 @@ public class CompletionsBase { protected List<? extends CompletionItem> items(String file, int row, int column) { URI uri = FindResource.uri(file); - TextDocumentPositionParams position = - new TextDocumentPositionParams( - new TextDocumentIdentifier(uri.toString()), new Position(row - 1, column - 1)); + CompletionParams position = + new CompletionParams(new TextDocumentIdentifier(uri.toString()), new Position(row - 1, column - 1)); try { return server.getTextDocumentService().completion(position).get().getRight().getItems(); diff --git a/src/test/java/org/javacs/JavaCompilerServiceTest.java b/src/test/java/org/javacs/JavaCompilerServiceTest.java index 66dac36..09e96ee 100644 --- a/src/test/java/org/javacs/JavaCompilerServiceTest.java +++ b/src/test/java/org/javacs/JavaCompilerServiceTest.java @@ -188,9 +188,10 @@ public class JavaCompilerServiceTest { @Test public void overloads() { - List<ExecutableElement> found = - compiler.overloads(URI.create("/Overloads.java"), contents("/Overloads.java"), 3, 15); + MethodInvocation found = + compiler.methodInvocation(URI.create("/Overloads.java"), contents("/Overloads.java"), 3, 15).get(); - assertThat(found, containsInAnyOrder(hasToString("print(int)"), hasToString("print(java.lang.String)"))); + assertThat( + found.overloads, containsInAnyOrder(hasToString("print(int)"), hasToString("print(java.lang.String)"))); } } diff --git a/src/test/java/org/javacs/SymbolUnderCursorTest.java b/src/test/java/org/javacs/SymbolUnderCursorTest.java index 1578fee..f01a5c1 100644 --- a/src/test/java/org/javacs/SymbolUnderCursorTest.java +++ b/src/test/java/org/javacs/SymbolUnderCursorTest.java @@ -95,6 +95,7 @@ public class SymbolUnderCursorTest { .hover(pos) .get() .getContents() + .getLeft() .forEach(hover -> result.add(hover.getRight().getValue())); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); |