This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/delivery by this push:
     new a810acd  Postpone config update to next Macrotask.
a810acd is described below

commit a810acdfcdb08e7d9fc1237e2fae46a768dea069
Author: OndÅ™ej Douda <[email protected]>
AuthorDate: Fri Nov 6 12:35:09 2020 +0100

    Postpone config update to next Macrotask.
---
 java/java.lsp.server/vscode/package.json     | 10 +++++-----
 java/java.lsp.server/vscode/src/extension.ts | 15 ++++++++++-----
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/java/java.lsp.server/vscode/package.json 
b/java/java.lsp.server/vscode/package.json
index bb46f63..5b51355 100644
--- a/java/java.lsp.server/vscode/package.json
+++ b/java/java.lsp.server/vscode/package.json
@@ -51,11 +51,11 @@
                                        "default" : true,
                                        "description": "Avoid conflicts with 
other Java extensions"
                                },
-                                "java.test.editor.enableShortcuts": {
-                                    "type": "boolean",
-                                    "default": false,
-                                    "description": "Enable Run/Debug test in 
editor"
-                                }
+                               "java.test.editor.enableShortcuts": {
+                                       "type": "boolean",
+                                       "default": false,
+                                       "description": "Enable Run/Debug test 
in editor"
+                               }
                        }
                },
                "breakpoints": [
diff --git a/java/java.lsp.server/vscode/src/extension.ts 
b/java/java.lsp.server/vscode/src/extension.ts
index cd741a4..7a3df78 100644
--- a/java/java.lsp.server/vscode/src/extension.ts
+++ b/java/java.lsp.server/vscode/src/extension.ts
@@ -91,14 +91,19 @@ function findJDK(onChange: (path : string | null) => void): 
void {
     }
 
     let currentJdk = find();
+    let timeout: NodeJS.Timeout | undefined = undefined;
     workspace.onDidChangeConfiguration(params => {
-        if (!params.affectsConfiguration('java') && 
!params.affectsConfiguration('netbeans')) {
+        if (timeout || (!params.affectsConfiguration('java') && 
!params.affectsConfiguration('netbeans'))) {
             return;
         }
-        let newJdk = find();
-        if (newJdk !== currentJdk) {
-            onChange(newJdk);
-        }
+        timeout = setTimeout(() => {
+            timeout = undefined;
+            let newJdk = find();
+            if (newJdk !== currentJdk) {
+                currentJdk = newJdk;
+                onChange(currentJdk);
+            }
+        }, 0);
     });
     onChange(currentJdk);
 }


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