use of io.typefox.lsapi.services.LanguageServer 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;
}
use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.
the class TextDocumentService method onTypeFormatting.
@POST
@Path("onTypeFormatting")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends TextEdit> onTypeFormatting(DocumentOnTypeFormattingParamsDTO 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().onTypeFormatting(params).get();
}
use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.
the class TextDocumentService method didOpen.
@POST
@Path("didOpen")
@Consumes(MediaType.APPLICATION_JSON)
public void didOpen(DidOpenTextDocumentParamsDTO openEvent) throws LanguageServerException {
openEvent.getTextDocument().setUri(prefixURI(openEvent.getTextDocument().getUri()));
openEvent.setUri(prefixURI(openEvent.getUri()));
LanguageServer server = getServer(openEvent.getTextDocument().getUri());
if (server != null) {
server.getTextDocumentService().didOpen(openEvent);
}
}
use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.
the class TextDocumentService method didChange.
@POST
@Path("didChange")
@Consumes(MediaType.APPLICATION_JSON)
public void didChange(DidChangeTextDocumentParamsDTO change) throws LanguageServerException {
change.getTextDocument().setUri(prefixURI(change.getTextDocument().getUri()));
change.setUri(prefixURI(change.getUri()));
LanguageServer server = getServer(change.getTextDocument().getUri());
if (server != null) {
server.getTextDocumentService().didChange(change);
}
}
use of io.typefox.lsapi.services.LanguageServer in project che by eclipse.
the class TextDocumentService method formatting.
@POST
@Path("formatting")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public List<? extends TextEdit> formatting(DocumentFormattingParamsDTO 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().formatting(params).get();
}
Aggregations