Search in sources :

Example 1 with LanguageServerImpl

use of org.eclipse.xtext.ide.server.LanguageServerImpl in project smarthome by eclipse.

the class ModelServer method handleConnection.

private void handleConnection(final Socket client) {
    logger.debug("Client {} connected", client.getRemoteSocketAddress());
    try {
        LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class);
        Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, client.getInputStream(), client.getOutputStream());
        languageServer.connect(launcher.getRemoteProxy());
        Future<?> future = launcher.startListening();
        future.get();
    } catch (IOException e) {
        logger.warn("Error communicating with LSP client {}", client.getRemoteSocketAddress());
    } catch (InterruptedException e) {
    // go on, let the thread finish
    } catch (ExecutionException e) {
        logger.error("Error running the Language Server", e);
    }
    logger.debug("Client {} disconnected", client.getRemoteSocketAddress());
}
Also used : LanguageServerImpl(org.eclipse.xtext.ide.server.LanguageServerImpl) LanguageClient(org.eclipse.lsp4j.services.LanguageClient) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 LanguageClient (org.eclipse.lsp4j.services.LanguageClient)1 LanguageServerImpl (org.eclipse.xtext.ide.server.LanguageServerImpl)1