Search in sources :

Example 1 with PublishDiagnosticsParamsImpl

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

the class PublishDiagnosticsParamsMessenger method onEvent.

public void onEvent(final PublishDiagnosticsParams event) {
    try {
        if (event instanceof PublishDiagnosticsParamsImpl && event.getUri().startsWith("file:///projects")) {
            ((PublishDiagnosticsParamsImpl) event).setUri(event.getUri().substring(16));
        }
        final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
        bm.setChannel("languageserver/textDocument/publishDiagnostics");
        bm.setBody(new Gson().toJson(event));
        WSConnectionContext.sendMessage(bm);
    } catch (EncodeException | IOException e) {
        LOG.error(e.getMessage(), e);
    }
}
Also used : ChannelBroadcastMessage(org.everrest.websockets.message.ChannelBroadcastMessage) Gson(com.google.gson.Gson) EncodeException(javax.websocket.EncodeException) PublishDiagnosticsParamsImpl(io.typefox.lsapi.impl.PublishDiagnosticsParamsImpl) IOException(java.io.IOException)

Aggregations

Gson (com.google.gson.Gson)1 PublishDiagnosticsParamsImpl (io.typefox.lsapi.impl.PublishDiagnosticsParamsImpl)1 IOException (java.io.IOException)1 EncodeException (javax.websocket.EncodeException)1 ChannelBroadcastMessage (org.everrest.websockets.message.ChannelBroadcastMessage)1