You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/02/21 09:00:33 UTC
[GitHub] [netbeans] sdedic commented on a change in pull request #3653: ClientCommandProvider split from CodeActionsProvider. NbLanguageClient moved to API package.
sdedic commented on a change in pull request #3653:
URL: https://github.com/apache/netbeans/pull/3653#discussion_r810904745
##########
File path: java/java.lsp.server/src/org/netbeans/spi/lsp/server/ClientCommandProvider.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.spi.lsp.server;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import org.netbeans.api.lsp.server.NbCodeLanguageClient;
+
+/**
+ * Contributes commands to the LSP client. Implementations are to be registered in the global Lookup. Each implementation must
+ * declare the supported commands in advance.
+ *
+ * @author sdedic
+ */
+public interface ClientCommandProvider {
+ /**
+ * Processes a command. Only commands previously reported by {@link #getCommands} are to be expected, the infrastructure dispatches
+ * commands only to provider(s) that have declared support for them.
+ *
+ * @param client the client which executed the command.
+ * @param command the command
+ * @param arguments arguments
+ * @return completion handle or {@code null} to reject the command.
+ */
+ public CompletableFuture<Object> processCommand(NbCodeLanguageClient client, String command, List<Object> arguments);
Review comment:
OK, should the `Context` (if used specifically for `ClientCommandProvider`) contain also the `command` and `arguments` parameters ?
##########
File path: java/java.lsp.server/src/org/netbeans/api/lsp/server/NbCodeLanguageClient.java
##########
@@ -26,10 +26,18 @@
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
import org.eclipse.lsp4j.services.LanguageClient;
+import org.netbeans.modules.java.lsp.server.protocol.DecorationRenderOptions;
+import org.netbeans.modules.java.lsp.server.protocol.HtmlPageParams;
+import org.netbeans.modules.java.lsp.server.protocol.QuickPickItem;
+import org.netbeans.modules.java.lsp.server.protocol.SetTextEditorDecorationParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowInputBoxParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowQuickPickParams;
+import org.netbeans.modules.java.lsp.server.protocol.ShowStatusMessageParams;
+import org.netbeans.modules.java.lsp.server.protocol.TestProgressParams;
/**
* An extension to the standard LanguageClient that adds several messages missing
- * from the official LSP protocol.s
+ * from the official LSP protocol.
* @author sdedic
*/
public interface NbCodeLanguageClient extends LanguageClient {
Review comment:
It has to (somehow) - otherwise the code wouldn't be able to call things like `showInputBox`. Additional messages can be added as `default` methods throwing UnsupportedOpEx. There are two additional ways: `final` class with protocol messages that will delegate all methods to NbCodeLanguageClient (internal API). Or the same with the `Context` proposed below.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists