Search in sources :

Example 16 with LanguageServer

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

Example 17 with LanguageServer

use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.

the class TextDocumentService method completion.

@POST
@Path("completion")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public CompletionList completion(TextDocumentPositionParamsDTO textDocumentPositionParams) throws InterruptedException, ExecutionException, LanguageServerException {
    textDocumentPositionParams.getTextDocument().setUri(prefixURI(textDocumentPositionParams.getTextDocument().getUri()));
    textDocumentPositionParams.setUri(prefixURI(textDocumentPositionParams.getUri()));
    LanguageServer server = getServer(textDocumentPositionParams.getTextDocument().getUri());
    if (server == null) {
        return null;
    }
    return server.getTextDocumentService().completion(textDocumentPositionParams).get();
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 18 with LanguageServer

use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.

the class TextDocumentService method rangeFormatting.

@POST
@Path("rangeFormatting")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends TextEdit> rangeFormatting(DocumentRangeFormattingParamsDTO params) throws InterruptedException, ExecutionException, LanguageServerException {
    params.getTextDocument().setUri(prefixURI(params.getTextDocument().getUri()));
    LanguageServer server = getServer(params.getTextDocument().getUri());
    if (server == null) {
        return emptyList();
    }
    return server.getTextDocumentService().rangeFormatting(params).get();
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 19 with LanguageServer

use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.

the class TextDocumentService method didSave.

@POST
@Path("didSave")
@Consumes(MediaType.APPLICATION_JSON)
public void didSave(DidSaveTextDocumentParamsDTO saveEvent) throws LanguageServerException {
    saveEvent.getTextDocument().setUri(prefixURI(saveEvent.getTextDocument().getUri()));
    LanguageServer server = getServer(saveEvent.getTextDocument().getUri());
    if (server != null) {
        server.getTextDocumentService().didSave(saveEvent);
    }
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes)

Example 20 with LanguageServer

use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.

the class TextDocumentService method signatureHelp.

@POST
@Path("signatureHelp")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public SignatureHelp signatureHelp(TextDocumentPositionParamsDTO positionParams) throws LanguageServerException, ExecutionException, InterruptedException {
    positionParams.getTextDocument().setUri(prefixURI(positionParams.getTextDocument().getUri()));
    positionParams.setUri(prefixURI(positionParams.getUri()));
    LanguageServer server = getServer(positionParams.getTextDocument().getUri());
    if (server != null) {
        return server.getTextDocumentService().signatureHelp(positionParams).get();
    } else {
        return null;
    }
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Aggregations

LanguageServer (io.typefox.lsapi.services.LanguageServer)21 Consumes (javax.ws.rs.Consumes)15 POST (javax.ws.rs.POST)15 Path (javax.ws.rs.Path)15 Produces (javax.ws.rs.Produces)10 LocationImpl (io.typefox.lsapi.impl.LocationImpl)3 InitializeResult (io.typefox.lsapi.InitializeResult)2 Test (org.testng.annotations.Test)2 InitializeParams (io.typefox.lsapi.InitializeParams)1 Location (io.typefox.lsapi.Location)1 ServerCapabilities (io.typefox.lsapi.ServerCapabilities)1 InitializeParamsImpl (io.typefox.lsapi.impl.InitializeParamsImpl)1 ExecutionException (java.util.concurrent.ExecutionException)1 PreDestroy (javax.annotation.PreDestroy)1 LanguageServerException (org.eclipse.che.api.languageserver.exception.LanguageServerException)1 LanguageServerLauncher (org.eclipse.che.api.languageserver.launcher.LanguageServerLauncher)1 ProjectExtensionKey (org.eclipse.che.api.languageserver.shared.ProjectExtensionKey)1 Nullable (org.eclipse.che.commons.annotation.Nullable)1