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

jtulach 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 521d95a  Avoid confusion by disabling code lenses for running, 
debugging and testing
     new 4e4688c  Merge pull request #2492 from 
JaroslavTulach/jtulach/AvoidConflicts
521d95a is described below

commit 521d95aef9a4470ba60bcf0ddd9501229cd8f135
Author: Jaroslav Tulach <[email protected]>
AuthorDate: Mon Oct 26 08:15:22 2020 +0100

    Avoid confusion by disabling code lenses for running, debugging and testing
---
 java/java.lsp.server/vscode/README.md        |  7 +++++++
 java/java.lsp.server/vscode/package.json     | 18 ++++++++++++++----
 java/java.lsp.server/vscode/src/extension.ts | 23 ++++++++++++++---------
 3 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/java/java.lsp.server/vscode/README.md 
b/java/java.lsp.server/vscode/README.md
index 4fe8a19..50ca1f0 100644
--- a/java/java.lsp.server/vscode/README.md
+++ b/java/java.lsp.server/vscode/README.md
@@ -104,3 +104,10 @@ following locations:
 - current system path
 
 As soon as one of the settings is changed, the NbCode Java part is restarted.
+
+## Conflicts with other Java Extensions
+
+Apache NetBeans Language Server extension isn't the only Java supporting
+extension. To avoid duplicated code completion and other misleading clashes
+the extension disables certain functionality known to cause problems. This
+behavior can be disabled by setting `netbeans.conflict.check` setting to 
`false`.
diff --git a/java/java.lsp.server/vscode/package.json 
b/java/java.lsp.server/vscode/package.json
index 834d915..7440635 100644
--- a/java/java.lsp.server/vscode/package.json
+++ b/java/java.lsp.server/vscode/package.json
@@ -36,10 +36,20 @@
                                        "default": null,
                                        "description": "Specifies JDK for the 
Apache NetBeans Language Server"
                                },
-                                "netbeans.verbose": {
-                                        "type": "boolean",
-                                        "default": false,
-                                        "description": "Enables verbose 
messages from the Apache NetBeans Language Server"
+                               "netbeans.verbose": {
+                                       "type": "boolean",
+                                       "default": false,
+                                       "description": "Enables verbose 
messages from the Apache NetBeans Language Server"
+                               },
+                               "netbeans.conflict.check" : {
+                                       "type" : "boolean",
+                                       "default" : true,
+                                       "description": "Avoid conflicts with 
other Java extensions"
+                               },
+                                "java.test.editor.enableShortcuts": {
+                                    "type": "boolean",
+                                    "default": false,
+                                    "description": "Enable Run/Debug test in 
editor"
                                 }
                        }
                },
diff --git a/java/java.lsp.server/vscode/src/extension.ts 
b/java/java.lsp.server/vscode/src/extension.ts
index 0f146b2..da0e8fc 100644
--- a/java/java.lsp.server/vscode/src/extension.ts
+++ b/java/java.lsp.server/vscode/src/extension.ts
@@ -103,15 +103,20 @@ function findJDK(onChange: (path : string | null) => 
void): void {
 export function activate(context: ExtensionContext) {
     let log = vscode.window.createOutputChannel("Apache NetBeans Language 
Server");
 
-    let e = vscode.extensions.getExtension('redhat.java');
-    log.appendLine(`workspace ${workspace.name}`);
-    if (e && workspace.name) {
-        vscode.window.showInformationMessage(`redhat.java found at 
${e.extensionPath} - Suppressing some services to not clash with Apache 
NetBeans Language Server.`);
-        workspace.getConfiguration().update('java.completion.enabled', false, 
false).then(() => {
-            vscode.window.showInformationMessage('Disabling redhat.java code 
completion. Usage of only one Java extension is recommended.');
-        }, (reason) => {
-            vscode.window.showInformationMessage('Disabling redhat.java code 
completion failed ' + reason);
-        });
+    let conf = workspace.getConfiguration();
+    if (conf.get("netbeans.conflict.check")) {
+        let e = vscode.extensions.getExtension('redhat.java');
+        function disablingFailed(reason: any) {
+            log.appendLine('Disabling some services failed ' + reason);
+        }
+        if (e && workspace.name) {
+            vscode.window.showInformationMessage(`redhat.java found at 
${e.extensionPath} - Suppressing some services to not clash with Apache 
NetBeans Language Server.`);
+            conf.update('java.completion.enabled', false, false).then(() => {
+                vscode.window.showInformationMessage('Usage of only one Java 
extension is recommended. Certain services of redhat.java have been disabled. 
');
+                conf.update('java.debug.settings.enableRunDebugCodeLens', 
false, false).then(() => {}, disablingFailed);
+                conf.update('java.test.editor.enableShortcuts', false, 
false).then(() => {}, disablingFailed);
+            }, disablingFailed);
+        }
     }
 
     // find acceptable JDK and launch the Java part


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