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' ;
77import * as appservice from '@microsoft/vscode-azext-azureappservice' ;
88import { type IActionContext } from '@microsoft/vscode-azext-utils' ;
99import * as vscode from 'vscode' ;
10+ import { workerRuntimeKey } from '../../constants' ;
1011import { type SlotTreeItem } from '../../tree/SlotTreeItem' ;
1112import { pickFunctionApp } from '../../utils/pickFunctionApp' ;
13+ import { getWorkspaceSetting } from '../../vsCodeConfig/settings' ;
14+ import { remoteDebugJavaFunctionApp } from '../remoteDebugJava/remoteDebugJavaFunctionApp' ;
1215import { getRemoteDebugLanguage } from './getRemoteDebugLanguage' ;
1316
1417export 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