org.eclipse.lsp4j.Unregistration Java Examples
The following examples show how to use
org.eclipse.lsp4j.Unregistration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultLanguageClient.java From lsp4intellij with Apache License 2.0 | 6 votes |
@Override public CompletableFuture<Void> unregisterCapability(UnregistrationParams params) { return CompletableFuture.runAsync(() -> params.getUnregisterations().forEach((Unregistration r) -> { String id = r.getId(); Optional<DynamicRegistrationMethods> method = DynamicRegistrationMethods.forName(r.getMethod()); if (registrations.containsKey(id)) { registrations.remove(id); } else { Map<DynamicRegistrationMethods, String> inverted = new HashMap<>(); for (Map.Entry<String, DynamicRegistrationMethods> entry : registrations.entrySet()) { inverted.put(entry.getValue(), entry.getKey()); } if (method.isPresent() && inverted.containsKey(method.get())) { registrations.remove(inverted.get(method.get())); } } })); }
Example #2
Source File: ExecutableCommandRegistry.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected IDisposable register(String command, IExecutableCommandService service) { String requestId = UUID.randomUUID().toString(); Registration reg = new Registration(); reg.setId(requestId); reg.setMethod(ExecutableCommandRegistry.METHOD); ExecuteCommandOptions executeCommandOptions = new ExecuteCommandOptions(); executeCommandOptions.setCommands(Collections.unmodifiableList(Lists.newArrayList(command))); reg.setRegisterOptions(executeCommandOptions); RegistrationParams registrationParams = new RegistrationParams(); registrationParams.setRegistrations(Lists.newArrayList(reg)); client.registerCapability(registrationParams); registeredCommands.put(command, service); return () -> { Unregistration unReg = new Unregistration(); unReg.setId(requestId); unReg.setMethod(ExecutableCommandRegistry.METHOD); UnregistrationParams unregistrationParams = new UnregistrationParams(); unregistrationParams.setUnregisterations(Lists.newArrayList(unReg)); this.client.unregisterCapability(unregistrationParams); this.registeredCommands.remove(command, service); }; }
Example #3
Source File: XMLCapabilityManager.java From lemminx with Eclipse Public License 2.0 | 5 votes |
public void unregisterCapability(String id, String method) { if (registeredCapabilities.remove(id)) { Unregistration unregistration = new Unregistration(id, method); UnregistrationParams unregistrationParams = new UnregistrationParams( Collections.singletonList(unregistration)); languageClient.unregisterCapability(unregistrationParams); } }
Example #4
Source File: BaseJDTLanguageServer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public void unregisterCapability(String id, String method) { if (registeredCapabilities.remove(id)) { Unregistration unregistration = new Unregistration(id, method); UnregistrationParams unregistrationParams = new UnregistrationParams(Collections.singletonList(unregistration)); client.unregisterCapability(unregistrationParams); } }
Example #5
Source File: CommandRegistryTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<Void> unregisterCapability(UnregistrationParams params) { Unregistration unreg = Iterables.getFirst(params.getUnregisterations(), null); registered.remove(unreg.getId()); return CompletableFuture.completedFuture(null); }
Example #6
Source File: UnregistrationParams.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
public UnregistrationParams() { this(new ArrayList<Unregistration>()); }
Example #7
Source File: UnregistrationParams.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
public UnregistrationParams(@NonNull final List<Unregistration> unregisterations) { this.unregisterations = Preconditions.<List<Unregistration>>checkNotNull(unregisterations, "unregisterations"); }
Example #8
Source File: UnregistrationParams.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Pure @NonNull public List<Unregistration> getUnregisterations() { return this.unregisterations; }
Example #9
Source File: UnregistrationParams.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
public void setUnregisterations(@NonNull final List<Unregistration> unregisterations) { this.unregisterations = Preconditions.checkNotNull(unregisterations, "unregisterations"); }