[vscode] Do not attempt to auto-connect if actuators not on classpath
This commit is contained in:
@@ -77,11 +77,13 @@ export function startDebugSupport(): Disposable {
|
||||
async function handleCustomDebugEvent(e: VSCode.DebugSessionCustomEvent): Promise<void> {
|
||||
if (e.session?.type === 'java' && e?.body?.type === 'processid') {
|
||||
const debugConfiguration: DebugConfiguration = e.session.configuration;
|
||||
setTimeout(async () => {
|
||||
const pid = await getAppPid(e.body as ProcessEvent);
|
||||
const processKey = pid.toString();
|
||||
VSCode.commands.executeCommand('sts/livedata/connect', { processKey });
|
||||
}, 500);
|
||||
if (canConnect(debugConfiguration)) {
|
||||
setTimeout(async () => {
|
||||
const pid = await getAppPid(e.body as ProcessEvent);
|
||||
const processKey = pid.toString();
|
||||
VSCode.commands.executeCommand('sts/livedata/connect', { processKey });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,3 +116,12 @@ function isActuatorJarFile(f: string): boolean {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function canConnect(debugConfiguration: DebugConfiguration): boolean {
|
||||
if (isActuatorOnClasspath(debugConfiguration)) {
|
||||
return debugConfiguration.vmArgs
|
||||
&& debugConfiguration.vmArgs.indexOf(`${JMX_VM_ARG}true`) >= 0
|
||||
&& debugConfiguration.vmArgs.indexOf(`${ADMIN_VM_ARG}true`) >= 0
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user