Search in sources :

Example 1 with TypeDefinitionParams

use of org.eclipse.lsp4j.TypeDefinitionParams in project eclipse.jdt.ls by eclipse.

the class SyntaxServerTest method testTypeDefinition.

@Test
public void testTypeDefinition() throws Exception {
    URI fileURI = openFile("maven/salut4", "src/main/java/java/Foo.java");
    TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileURI.toString());
    TypeDefinitionParams params = new TypeDefinitionParams(identifier, new Position(11, 24));
    Either<List<? extends Location>, List<? extends LocationLink>> result = server.typeDefinition(params).join();
    assertTrue(result.isLeft());
    assertNotNull(result.getLeft());
    assertEquals(1, result.getLeft().size());
    String targetUri = result.getLeft().get(0).getUri();
    assertNotNull(targetUri);
    assertEquals(ResourceUtils.toClientUri(getFileUri("maven/salut4", "src/main/java/java/Bar.java")), targetUri);
}
Also used : LocationLink(org.eclipse.lsp4j.LocationLink) TextDocumentIdentifier(org.eclipse.lsp4j.TextDocumentIdentifier) TypeDefinitionParams(org.eclipse.lsp4j.TypeDefinitionParams) Position(org.eclipse.lsp4j.Position) List(java.util.List) CompletionList(org.eclipse.lsp4j.CompletionList) MarkedString(org.eclipse.lsp4j.MarkedString) URI(java.net.URI) Location(org.eclipse.lsp4j.Location) Test(org.junit.Test)

Aggregations

URI (java.net.URI)1 List (java.util.List)1 CompletionList (org.eclipse.lsp4j.CompletionList)1 Location (org.eclipse.lsp4j.Location)1 LocationLink (org.eclipse.lsp4j.LocationLink)1 MarkedString (org.eclipse.lsp4j.MarkedString)1 Position (org.eclipse.lsp4j.Position)1 TextDocumentIdentifier (org.eclipse.lsp4j.TextDocumentIdentifier)1 TypeDefinitionParams (org.eclipse.lsp4j.TypeDefinitionParams)1 Test (org.junit.Test)1