Search in sources :

Example 1 with InitializeParamsImpl

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

the class ServerInitializerImpl method prepareInitializeParams.

protected InitializeParamsImpl prepareInitializeParams(String projectPath) {
    InitializeParamsImpl initializeParams = new InitializeParamsImpl();
    initializeParams.setProcessId(PROCESS_ID);
    initializeParams.setRootPath(projectPath);
    initializeParams.setCapabilities(new ClientCapabilitiesImpl());
    initializeParams.setClientName(CLIENT_NAME);
    return initializeParams;
}
Also used : InitializeParamsImpl(io.typefox.lsapi.impl.InitializeParamsImpl) ClientCapabilitiesImpl(io.typefox.lsapi.impl.ClientCapabilitiesImpl)

Example 2 with InitializeParamsImpl

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

the class ServerInitializerImpl method doInitialize.

protected LanguageServer doInitialize(LanguageServerLauncher launcher, String projectPath) throws LanguageServerException {
    String languageId = launcher.getLanguageDescription().getLanguageId();
    InitializeParamsImpl initializeParams = prepareInitializeParams(projectPath);
    LanguageServer server;
    try {
        server = launcher.launch(projectPath);
    } catch (LanguageServerException e) {
        throw new LanguageServerException("Can't initialize Language Server " + languageId + " on " + projectPath + ". " + e.getMessage(), e);
    }
    registerCallbacks(server);
    CompletableFuture<InitializeResult> completableFuture = server.initialize(initializeParams);
    try {
        InitializeResult initializeResult = completableFuture.get();
        serversToInitResult.put(server, new LanguageServerDescription(initializeResult, launcher.getLanguageDescription()));
    } catch (InterruptedException | ExecutionException e) {
        server.shutdown();
        server.exit();
        throw new LanguageServerException("Error fetching server capabilities " + languageId + ". " + e.getMessage(), e);
    }
    LOG.info("Initialized Language Server {} on project {}", languageId, projectPath);
    return server;
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) InitializeResult(io.typefox.lsapi.InitializeResult) InitializeParamsImpl(io.typefox.lsapi.impl.InitializeParamsImpl) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

InitializeParamsImpl (io.typefox.lsapi.impl.InitializeParamsImpl)2 InitializeResult (io.typefox.lsapi.InitializeResult)1 ClientCapabilitiesImpl (io.typefox.lsapi.impl.ClientCapabilitiesImpl)1 LanguageServer (io.typefox.lsapi.services.LanguageServer)1 ExecutionException (java.util.concurrent.ExecutionException)1 LanguageServerException (org.eclipse.che.api.languageserver.exception.LanguageServerException)1