import * as vscode from 'vscode' ; import { IActionContext } from 'vscode-azureextensionui' ; import { ext } from '../extensionVariables' ; import { localize } from '../localize' ; import { FunctionTreeItemBase } from '../tree/FunctionTreeItemBase' ; export async function copyFunctionUrl ( context , node ? ) { if ( ! node ) { const noItemFoundErrorMessage = localize ( 'noHTTPFunctions' , 'No HTTP functions found.' ) ; node = await ext . tree . showTreeItemPicker < FunctionTreeItemBase > ( /Function;Http;/i , { ... context , noItemFoundErrorMessage } ) ; } const triggerRequest = await node . getTriggerRequest ( context ) ; if ( triggerRequest ) { await vscode . env . clipboard . writeText ( triggerRequest . url ) ; } else { throw new Error ( localize ( 'CopyFailedForNonHttp' , 'Function URLs can only be used for HTTP triggers.' ) ) ; } }