use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.
the class LanguageServerRegistryImpl method extractProjectPath.
protected String extractProjectPath(String filePath) throws LanguageServerException {
FolderEntry root;
try {
root = projectManagerProvider.get().getProjectsRoot();
} catch (ServerException e) {
throw new LanguageServerException("Project not found for " + filePath, e);
}
if (!filePath.startsWith(PROJECT_FOLDER_PATH)) {
throw new LanguageServerException("Project not found for " + filePath);
}
VirtualFileEntry fileEntry;
try {
fileEntry = root.getChild(filePath.substring(PROJECT_FOLDER_PATH.length() + 1));
} catch (ServerException e) {
throw new LanguageServerException("Project not found for " + filePath, e);
}
if (fileEntry == null) {
throw new LanguageServerException("Project not found for " + filePath);
}
return PROJECT_FOLDER_PATH + fileEntry.getProject();
}
use of org.eclipse.che.api.languageserver.exception.LanguageServerException 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;
}
use of org.eclipse.che.api.languageserver.exception.LanguageServerException in project che by eclipse.
the class PythonLanguageSeverLauncher 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 CSharp language server", e);
}
}
Aggregations