Search in sources :

Example 1 with LanguageServerException

use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.

the class PhpLanguageServerLauncher method startLanguageServerProcess.

protected Process startLanguageServerProcess(String projectPath) throws LanguageServerException {
    ProcessBuilder processBuilder = new ProcessBuilder(launchScript.toString());
    processBuilder.redirectInput(ProcessBuilder.Redirect.PIPE);
    processBuilder.redirectOutput(ProcessBuilder.Redirect.PIPE);
    try {
        return processBuilder.start();
    } catch (IOException e) {
        throw new LanguageServerException("Can't start PHP language server", e);
    }
}
Also used : LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) IOException(java.io.IOException)

Example 2 with LanguageServerException

use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.

the class CSharpLanguageServerLauncher method startLanguageServerProcess.

@Override
protected Process startLanguageServerProcess(String projectPath) throws LanguageServerException {
    restoreDependencies(projectPath);
    ProcessBuilder processBuilder = new ProcessBuilder(launchScript.toString());
    processBuilder.redirectInput(ProcessBuilder.Redirect.PIPE);
    processBuilder.redirectOutput(ProcessBuilder.Redirect.PIPE);
    try {
        return processBuilder.start();
    } catch (IOException e) {
        throw new LanguageServerException("Can't start CSharp language server", e);
    }
}
Also used : LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) IOException(java.io.IOException)

Example 3 with LanguageServerException

use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.

the class TSLSLauncher method startLanguageServerProcess.

@Override
protected Process startLanguageServerProcess(String projectPath) throws LanguageServerException {
    ProcessBuilder processBuilder = new ProcessBuilder(launchScript.toString());
    processBuilder.redirectInput(ProcessBuilder.Redirect.PIPE);
    processBuilder.redirectOutput(ProcessBuilder.Redirect.PIPE);
    try {
        return processBuilder.start();
    } catch (IOException e) {
        throw new LanguageServerException("Can't start TypeScript language server", e);
    }
}
Also used : LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) IOException(java.io.IOException)

Example 4 with LanguageServerException

use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.

the class CSharpLanguageServerLauncher method restoreDependencies.

private void restoreDependencies(String projectPath) throws LanguageServerException {
    ProcessBuilder processBuilder = new ProcessBuilder("dotnet", "restore");
    processBuilder.directory(new File(projectPath));
    try {
        Process process = processBuilder.start();
        int resultCode = process.waitFor();
        if (resultCode != 0) {
            String err = IoUtil.readStream(process.getErrorStream());
            String in = IoUtil.readStream(process.getInputStream());
            throw new LanguageServerException("Can't restore dependencies. Error: " + err + ". Output: " + in);
        }
    } catch (IOException | InterruptedException e) {
        throw new LanguageServerException("Can't start CSharp language server", e);
    }
}
Also used : LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) IOException(java.io.IOException) File(java.io.File)

Example 5 with LanguageServerException

use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.

the class JsonLanguageServerLauncher method startLanguageServerProcess.

protected Process startLanguageServerProcess(String projectPath) throws LanguageServerException {
    ProcessBuilder processBuilder = new ProcessBuilder(launchScript.toString());
    processBuilder.redirectInput(ProcessBuilder.Redirect.PIPE);
    processBuilder.redirectOutput(ProcessBuilder.Redirect.PIPE);
    try {
        return processBuilder.start();
    } catch (IOException e) {
        throw new LanguageServerException("Can't start JSON language server", e);
    }
}
Also used : LanguageServerException(org.eclipse.che.api.languageserver.exception.LanguageServerException) IOException(java.io.IOException)

Aggregations

LanguageServerException (org.eclipse.che.api.languageserver.exception.LanguageServerException)8 IOException (java.io.IOException)6 InitializeResult (io.typefox.lsapi.InitializeResult)1 InitializeParamsImpl (io.typefox.lsapi.impl.InitializeParamsImpl)1 LanguageServer (io.typefox.lsapi.services.LanguageServer)1 File (java.io.File)1 ExecutionException (java.util.concurrent.ExecutionException)1 ServerException (org.eclipse.che.api.core.ServerException)1 FolderEntry (org.eclipse.che.api.project.server.FolderEntry)1 VirtualFileEntry (org.eclipse.che.api.project.server.VirtualFileEntry)1