use of org.eclipse.lsp4j.ExecuteCommandCapabilities in project xtext-core by eclipse.
the class ExecutableCommandRegistry method initialize.
public void initialize(Iterable<? extends IResourceServiceProvider> allLanguages, ClientCapabilities capabilities, LanguageClient client) {
this.client = client;
this.registeredCommands = HashMultimap.create();
boolean hasDynamicRegistration = false;
WorkspaceClientCapabilities workspace = capabilities.getWorkspace();
if (workspace != null) {
ExecuteCommandCapabilities executeCommandCapabilities = workspace.getExecuteCommand();
if (executeCommandCapabilities != null) {
Boolean dynamicRegistration = executeCommandCapabilities.getDynamicRegistration();
if (dynamicRegistration != null) {
hasDynamicRegistration = dynamicRegistration.booleanValue();
}
}
}
for (IResourceServiceProvider lang : allLanguages) {
IExecutableCommandService service = lang.get(IExecutableCommandService.class);
if (service != null) {
List<String> commands = service.initialize();
for (String c : commands) {
registeredCommands.put(c, service);
}
if (hasDynamicRegistration) {
service.initializeDynamicRegistration((String command) -> {
return register(command, service);
});
}
}
}
}
Aggregations