Search in sources :

Example 1 with ErlangLanguageServer

use of org.erlide.server.ErlangLanguageServer in project erlide_eclipse by erlang.

the class ProjectSpecificLanguageServerWrapper method start.

private void start() throws IOException {
    if (server != null) {
        return;
    }
    server = new ErlangLanguageServer();
    // server.onError(new Procedure2<String, Throwable>() {
    // @Override
    // public void apply(final String p1, final Throwable p2) {
    // System.err.println(p1);
    // p2.printStackTrace();
    // }
    // });
    lspStreamProvider.start();
    // server.connect(lspStreamProvider.getInputStream(),
    // lspStreamProvider.getOutputStream());
    // server.getProtocol().addErrorListener(new Procedure2<String, Throwable>() {
    // @Override
    // public void apply(final String p1, final Throwable p2) {
    // System.err.println("error: " + p1);
    // }
    // });
    // server.getProtocol()
    // .addIncomingMessageListener(new Procedure2<Message, String>() {
    // @Override
    // public void apply(final Message p1, final String p2) {
    // System.err.println("IN: " + p1.getJsonrpc() + "\n" + p2);
    // }
    // });
    // server.getProtocol()
    // .addOutgoingMessageListener(new Procedure2<Message, String>() {
    // @Override
    // public void apply(final Message p1, final String p2) {
    // System.err.println("OUT: " + p1.getJsonrpc() + "\n" + p2);
    // }
    // });
    // initialize
    final InitializeParams initParams = new InitializeParams();
    initParams.setRootPath(project.getLocation().toFile().getAbsolutePath());
    String name = "Eclipse IDE";
    if (Platform.getProduct() != null) {
        name = Platform.getProduct().getName();
    }
    initParams.setClientName(name);
    Integer.valueOf(java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
    initParams.setCapabilities(new ClientCapabilities());
    connectDiagnostics();
    final CompletableFuture<InitializeResult> result = server.initialize(initParams);
    try {
        final InitializeResult initializeResult = result.get();
    } catch (InterruptedException | ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    connectedFiles = new HashMap<>();
}
Also used : ErlangLanguageServer(org.erlide.server.ErlangLanguageServer) InitializeResult(org.eclipse.lsp4j.InitializeResult) ClientCapabilities(org.eclipse.lsp4j.ClientCapabilities) InitializeParams(org.eclipse.lsp4j.InitializeParams) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 ClientCapabilities (org.eclipse.lsp4j.ClientCapabilities)1 InitializeParams (org.eclipse.lsp4j.InitializeParams)1 InitializeResult (org.eclipse.lsp4j.InitializeResult)1 ErlangLanguageServer (org.erlide.server.ErlangLanguageServer)1