use of org.eclipse.che.api.languageserver.shared.ProjectExtensionKey in project che by eclipse.
the class LanguageServerRegistry method register.
/**
* Registers language server description and capabilities.
*/
protected void register(String projectPath, LanguageDescription languageDescription, ServerCapabilities capabilities) {
InitializeResult initializeResult = new InitializeResultImpl(capabilities, languageDescription);
for (String ext : languageDescription.getFileExtensions()) {
ProjectExtensionKey key = createProjectKey(projectPath, ext);
projectToInitResult.put(key, initializeResult);
if (callbackMap.containsKey(key)) {
Callback<InitializeResult, Throwable> callback = callbackMap.remove(key);
callback.onSuccess(initializeResult);
}
}
}
use of org.eclipse.che.api.languageserver.shared.ProjectExtensionKey in project che by eclipse.
the class LanguageServerRegistryImpl method findServer.
@Nullable
protected LanguageServer findServer(String extension, String projectPath) throws LanguageServerException {
ProjectExtensionKey projectKey = createProjectKey(projectPath, extension);
for (LanguageServerLauncher launcher : extensionToLauncher.get(extension)) {
if (!projectToServer.containsKey(projectKey)) {
synchronized (launcher) {
if (!projectToServer.containsKey(projectKey)) {
LanguageServer server = initializer.initialize(launcher, projectPath);
projectToServer.put(projectKey, server);
}
}
}
return projectToServer.get(projectKey);
}
return null;
}
Aggregations