Skip to content

Commit

Permalink
Add a protected method for easy configuration of retrieval of
Browse files Browse the repository at this point in the history
Configuration Items
  • Loading branch information
rubenporras committed Aug 14, 2024
1 parent a1d06f6 commit 0c6e873
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -75,14 +77,18 @@ protected final LanguageServer getLanguageServer() {

@Override
public CompletableFuture<List<@Nullable Object>> 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
Expand Down

0 comments on commit 0c6e873

Please sign in to comment.