Search in sources :

Example 1 with LocationImpl

use of io.typefox.lsapi.impl.LocationImpl in project che by eclipse.

the class TextDocumentService method definition.

@POST
@Path("definition")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends Location> definition(TextDocumentPositionParamsDTO params) throws ExecutionException, InterruptedException, LanguageServerException {
    params.getTextDocument().setUri(prefixURI(params.getTextDocument().getUri()));
    LanguageServer server = getServer(params.getTextDocument().getUri());
    if (server == null) {
        return emptyList();
    }
    List<? extends Location> locations = server.getTextDocumentService().definition(params).get();
    locations.forEach(o -> {
        if (o instanceof LocationImpl) {
            ((LocationImpl) o).setUri(removePrefixUri(o.getUri()));
        }
    });
    return locations;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) LocationImpl(io.typefox.lsapi.impl.LocationImpl) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 2 with LocationImpl

use of io.typefox.lsapi.impl.LocationImpl in project che by eclipse.

the class WorkspaceService method documentSymbol.

@POST
@Path("symbol")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends SymbolInformation> documentSymbol(WorkspaceSymbolParamsDTO workspaceSymbolParams) throws ExecutionException, InterruptedException, LanguageServerException {
    LanguageServer server = getServer(TextDocumentService.prefixURI(workspaceSymbolParams.getFileUri()));
    if (server == null) {
        return emptyList();
    }
    List<? extends SymbolInformation> informations = server.getWorkspaceService().symbol(workspaceSymbolParams).get();
    informations.forEach(o -> {
        Location location = o.getLocation();
        if (location instanceof LocationImpl) {
            ((LocationImpl) location).setUri(TextDocumentService.removePrefixUri(location.getUri()));
        }
    });
    return informations;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) LocationImpl(io.typefox.lsapi.impl.LocationImpl) Location(io.typefox.lsapi.Location) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 3 with LocationImpl

use of io.typefox.lsapi.impl.LocationImpl in project che by eclipse.

the class TextDocumentService method references.

@POST
@Path("references")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends Location> references(ReferenceParamsDTO params) throws ExecutionException, InterruptedException, LanguageServerException {
    params.getTextDocument().setUri(prefixURI(params.getTextDocument().getUri()));
    LanguageServer server = getServer(params.getTextDocument().getUri());
    if (server == null) {
        return emptyList();
    }
    List<? extends Location> locations = server.getTextDocumentService().references(params).get();
    locations.forEach(o -> {
        if (o instanceof LocationImpl) {
            ((LocationImpl) o).setUri(removePrefixUri(o.getUri()));
        }
    });
    return locations;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) LocationImpl(io.typefox.lsapi.impl.LocationImpl) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Aggregations

LocationImpl (io.typefox.lsapi.impl.LocationImpl)3 LanguageServer (io.typefox.lsapi.services.LanguageServer)3 Consumes (javax.ws.rs.Consumes)3 POST (javax.ws.rs.POST)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 Location (io.typefox.lsapi.Location)1