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<>();
}
Aggregations