From 0c6e873ef371ee07c82fc624630e93a38609a3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Porras=20Campo?= Date: Wed, 14 Aug 2024 17:12:26 +0200 Subject: [PATCH] Add a protected method for easy configuration of retrieval of Configuration Items --- .../src/org/eclipse/lsp4e/LanguageClientImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java index ff86948a9..cc8395636 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java @@ -13,6 +13,7 @@ *******************************************************************************/ package org.eclipse.lsp4e; +import static org.eclipse.lsp4e.internal.NullSafetyHelper.castNonNull; import static org.eclipse.lsp4e.internal.NullSafetyHelper.lateNonNull; import java.util.ArrayList; @@ -33,6 +34,7 @@ import org.eclipse.lsp4e.ui.UI; import org.eclipse.lsp4j.ApplyWorkspaceEditParams; import org.eclipse.lsp4j.ApplyWorkspaceEditResponse; +import org.eclipse.lsp4j.ConfigurationItem; import org.eclipse.lsp4j.ConfigurationParams; import org.eclipse.lsp4j.Location; import org.eclipse.lsp4j.MessageActionItem; @@ -75,14 +77,18 @@ protected final LanguageServer getLanguageServer() { @Override public CompletableFuture> configuration(ConfigurationParams configurationParams) { - // override as needed List<@Nullable Object> list = new ArrayList<>(configurationParams.getItems().size()); - for (int i = 0; i < configurationParams.getItems().size(); i++) { - list.add(null); + for (ConfigurationItem item: configurationParams.getItems()) { + list.add(getConfigurationItem(castNonNull(item))); } return CompletableFuture.completedFuture(list); } + // override as needed + protected @Nullable Object getConfigurationItem(ConfigurationItem item) { + return null; + } + @Override public void telemetryEvent(@Nullable Object object) { // TODO