sdedic commented on a change in pull request #2987:
URL: https://github.com/apache/netbeans/pull/2987#discussion_r645536492



##########
File path: 
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/DebugConnector.java
##########
@@ -131,20 +166,19 @@ public boolean equals(Object obj) {
         if (!Objects.equals(this.arguments, other.arguments)) {
             return false;
         }
-        if (!Objects.equals(this.defaultValues, other.defaultValues)) {
-            return false;
-        }
         return true;
     }
 
     @Pure
     @Override
     public String toString() {
         ToStringBuilder b = new ToStringBuilder(this);
+        b.add("name", id);

Review comment:
       nitpick: bad label.

##########
File path: java/java.lsp.server/vscode/src/extension.ts
##########
@@ -705,13 +732,38 @@ class NetBeansConfigurationProvider implements 
vscode.DebugConfigurationProvider
                     request: "attach",
                 };
                 for (let i = 0; i < ac.arguments.length; i++) {
-                    debugConfig[ac.arguments[i]] = ac.defaultValues[i];
+                    let defaultValue: string = ac.defaultValues[i];
+                    if (!defaultValue.startsWith("${command:")) {
+                        // Create a command that asks for the argument value:
+                        let cmd: string = "java.attachDebugger.connector." + 
ac.id + "." + ac.arguments[i];
+                        debugConfig[ac.arguments[i]] = "${command:" + cmd + 
"}";
+                        if (!commandValues.has(cmd)) {
+                            commandValues.set(cmd, ac.defaultValues[i]);
+                            let description: string = ac.descriptions[i];
+                            
context.subscriptions.push(commands.registerCommand(cmd, async (ctx) => {
+                                return vscode.window.showInputBox({
+                                    prompt: description,
+                                    value: commandValues.get(cmd),
+                                }).then((value) => {
+                                    if (value) {
+                                        commandValues.set(cmd, value);

Review comment:
       I can see that the `commandValues` storage receives user input. Is the 
InputBox displayed each time the `debugConfig` is launched (although pre-filled 
with the previous input) ?
   

##########
File path: java/java.lsp.server/vscode/src/extension.ts
##########
@@ -705,13 +732,38 @@ class NetBeansConfigurationProvider implements 
vscode.DebugConfigurationProvider
                     request: "attach",
                 };
                 for (let i = 0; i < ac.arguments.length; i++) {
-                    debugConfig[ac.arguments[i]] = ac.defaultValues[i];
+                    let defaultValue: string = ac.defaultValues[i];
+                    if (!defaultValue.startsWith("${command:")) {
+                        // Create a command that asks for the argument value:
+                        let cmd: string = "java.attachDebugger.connector." + 
ac.id + "." + ac.arguments[i];
+                        debugConfig[ac.arguments[i]] = "${command:" + cmd + 
"}";
+                        if (!commandValues.has(cmd)) {
+                            commandValues.set(cmd, ac.defaultValues[i]);
+                            let description: string = ac.descriptions[i];
+                            
context.subscriptions.push(commands.registerCommand(cmd, async (ctx) => {
+                                return vscode.window.showInputBox({
+                                    prompt: description,
+                                    value: commandValues.get(cmd),
+                                }).then((value) => {
+                                    if (value) {
+                                        commandValues.set(cmd, value);
+                                    }
+                                    return value;
+                                });
+                            }));
+                        }
+                    } else {
+                        debugConfig[ac.arguments[i]] = defaultValue;

Review comment:
       So if LSP server sends some dynamic default value, the client must 
implement prompting for that value (if desirable) ?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to