Skip to content

Commit 80248de

Browse files
Copilotmotm32
andauthored
Respect Java remote debugging setting precedence when both debug modes are enabled (#4901)
* Initial plan * Fix Java remote debugging precedence over Node.js remote debugging Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com> * Remove trailing whitespace Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
1 parent 4e6f48e commit 80248de

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/commands/remoteDebug/startRemoteDebug.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { type SiteConfig } from '@azure/arm-appservice';
6+
import { type SiteConfig, type StringDictionary } from '@azure/arm-appservice';
77
import * as appservice from '@microsoft/vscode-azext-azureappservice';
88
import { type IActionContext } from '@microsoft/vscode-azext-utils';
99
import * as vscode from 'vscode';
10+
import { workerRuntimeKey } from '../../constants';
1011
import { type SlotTreeItem } from '../../tree/SlotTreeItem';
1112
import { pickFunctionApp } from '../../utils/pickFunctionApp';
13+
import { getWorkspaceSetting } from '../../vsCodeConfig/settings';
14+
import { remoteDebugJavaFunctionApp } from '../remoteDebugJava/remoteDebugJavaFunctionApp';
1215
import { getRemoteDebugLanguage } from './getRemoteDebugLanguage';
1316

1417
export async function startRemoteDebug(context: IActionContext, node?: SlotTreeItem): Promise<void> {
@@ -18,6 +21,19 @@ export async function startRemoteDebug(context: IActionContext, node?: SlotTreeI
1821

1922
await node.initSite(context);
2023
const siteClient = await node.site.createClient(context);
24+
25+
// Check if Java remote debugging is enabled and if this is a Java function app
26+
const isJavaRemoteDebuggingEnabled: boolean = !!getWorkspaceSetting<boolean>('enableJavaRemoteDebugging');
27+
if (isJavaRemoteDebuggingEnabled) {
28+
const appSettings: StringDictionary = await siteClient.listApplicationSettings();
29+
const workerRuntime: string | undefined = appSettings.properties?.[workerRuntimeKey];
30+
31+
// If this is a Java app, delegate to Java remote debugging
32+
if (workerRuntime?.toLowerCase() === 'java') {
33+
return await remoteDebugJavaFunctionApp(context, node);
34+
}
35+
}
36+
2137
const siteConfig: SiteConfig = await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, cancellable: true }, async (progress, token) => {
2238
appservice.reportMessage('Fetching site configuration...', progress, token);
2339
return await siteClient.getSiteConfig();

0 commit comments

Comments
 (0)