Skip to content

Commit a5f7a4d

Browse files
authored
Debug command for java and nodejs components (#1322)
Signed-off-by: Denis Golovin <dgolovin@redhat.com>
1 parent 70ca0a4 commit a5f7a4d

File tree

5 files changed

+228
-42
lines changed

5 files changed

+228
-42
lines changed

package-lock.json

Lines changed: 61 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
"onCommand:openshift.url.delete.palette",
8282
"onCommand:openshift.component.openUrl",
8383
"onCommand:openshift.component.openUrl.palette",
84+
"onCommand:openshift.component.debug",
85+
"onCommand:openshift.component.debug.palette",
8486
"onCommand:openshift.storage.create",
8587
"onCommand:openshift.storage.delete",
8688
"onCommand:openshift.service.create",
@@ -400,6 +402,16 @@
400402
"title": "Open Component in Browser",
401403
"category": "OpenShift"
402404
},
405+
{
406+
"command": "openshift.component.debug",
407+
"title": "Debug",
408+
"category": "OpenShift"
409+
},
410+
{
411+
"command": "openshift.component.debug.palette",
412+
"title": "Debug Component",
413+
"category": "OpenShift"
414+
},
403415
{
404416
"command": "openshift.storage.create",
405417
"title": "New Storage",
@@ -618,6 +630,10 @@
618630
"command": "openshift.component.openUrl",
619631
"when": "view == openshiftProjectExplorer"
620632
},
633+
{
634+
"command": "openshift.component.debug",
635+
"when": "view == openshiftProjectExplorer"
636+
},
621637
{
622638
"command": "openshift.component.unlink",
623639
"when": "view == openshiftProjectExplorer"
@@ -887,6 +903,11 @@
887903
"when": "view == openshiftProjectExplorer && viewItem == component",
888904
"group": "c4@4"
889905
},
906+
{
907+
"command": "openshift.component.debug",
908+
"when": "view == openshiftProjectExplorer && viewItem == component",
909+
"group": "c4@5"
910+
},
890911
{
891912
"command": "openshift.component.delete",
892913
"when": "view == openshiftProjectExplorer && viewItem == component_no_context",
@@ -988,6 +1009,7 @@
9881009
"@types/mkdirp": "^0.5.2",
9891010
"@types/mocha": "^5.2.7",
9901011
"@types/node": "^12.12.7",
1012+
"@types/pify": "^3.0.2",
9911013
"@types/shelljs": "^0.8.6",
9921014
"@types/sinon": "^5.0.7",
9931015
"@types/sinon-chai": "^3.2.3",
@@ -1033,8 +1055,10 @@
10331055
"source-map-support": "^0.5.16",
10341056
"string-format": "^2.0.0",
10351057
"targz": "^1.0.1",
1058+
"tree-kill": "^1.2.2",
10361059
"unzip-stream": "^0.3.0",
10371060
"validator": "^12.0.0",
1038-
"vscode-kubernetes-tools-api": "1.0.0"
1061+
"vscode-kubernetes-tools-api": "1.0.0",
1062+
"wait-port": "^0.2.7"
10391063
}
10401064
}

src/extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export async function activate(context: vscode.ExtensionContext) {
9494
vscode.commands.registerCommand('openshift.component.followLog.palette', (context) => execute(Component.followLog, context)),
9595
vscode.commands.registerCommand('openshift.component.openUrl', (context) => execute(Component.openUrl, context)),
9696
vscode.commands.registerCommand('openshift.component.openUrl.palette', (context) => execute(Component.openUrl, context)),
97+
vscode.commands.registerCommand('openshift.component.debug', (context) => execute(Component.debug, context)),
98+
vscode.commands.registerCommand('openshift.component.debug.palette', (context) => execute(Component.debug, context)),
9799
vscode.commands.registerCommand('openshift.component.delete', (context) => execute(Component.del, context)),
98100
vscode.commands.registerCommand('openshift.storage.create', (context) => execute(Storage.create, context)),
99101
vscode.commands.registerCommand('openshift.storage.delete.palette', (context) => execute(Storage.del, context)),
@@ -141,6 +143,11 @@ export async function activate(context: vscode.ExtensionContext) {
141143
OdoImpl.Instance.loadWorkspaceComponents(event);
142144
});
143145
OdoImpl.Instance.loadWorkspaceComponents(null);
146+
context.subscriptions.push(vscode.debug.onDidTerminateDebugSession(session => {
147+
if (session.configuration.odoPid) {
148+
require('tree-kill')(session.configuration.odoPid);
149+
}
150+
}));
144151
}
145152

146153
let lastNamespace = '';

0 commit comments

Comments
 (0)