import * as vscode from 'vscode' ; import { LocalTunnelDebugProvider } from './localtunneldebugprovider.extension' ; import { getLocalTunnelDebugProvider } from '../config/config' ; export class LocalTunnelDebugger { private readonly providers = Array . of < LocalTunnelDebugProvider > ( ) ; register ( provider ) { console . log ( `Registered local tunnel debugger type ${ provider . id }` ) ; this . providers . push ( provider ) ; } startLocalTunnelDebugSession ( target ? ) { const providerSetting = getLocalTunnelDebugProvider ( ) ; const providerName = providerSetting ? providerSetting : this . providers . map ( ( p ) => p . id ) . sort ( ) [ 0 ] ; const providerToUse = this . providers . find ( ( p ) => p . id === providerName ) ; if ( providerToUse ) { providerToUse . startLocalTunnelDebugging ( target ) ; return ; } let message = "" ; if ( providerName ) { message = `You have configured VSCode to use Local Tunnel debugger '${ providerName }', but it is not installed.` ; } else if ( ! this . providers . length ) { message = 'You do not have a Local Tunnel Debug Provider installed.' ; } LocalTunnelDebugger . promptToFindOnMarketplace ( message ) ; } ; static promptToFindOnMarketplace ( message ) { const browseExtensions = "Find Providers on Marketplace" ; vscode . window . showInformationMessage ( message , browseExtensions ) . then ( ( selection ) => { if ( selection === browseExtensions ) { vscode . commands . executeCommand ( 'extension.vsKubernetesFindLocalTunnelDebugProviders' ) ; } } ) ; } }