Search in sources :

Example 1 with Location

use of io.typefox.lsapi.Location 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)

Aggregations

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