Commit 521d95ae authored by Jaroslav Tulach's avatar Jaroslav Tulach
Browse files

Avoid confusion by disabling code lenses for running, debugging and testing

parent 97cf432b
......@@ -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`.
......@@ -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"
}
}
},
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment