Containers/Get-VSCodeExtensionFromContainer.ps1

function Get-VSCodeExtensionFromContainer {
    Param(
        [Parameter(Mandatory=$false)]
        [string]$ContainerName = (Get-ContainerFromLaunchJson)
    )

    try { 
        $Logs = docker logs $ContainerName 
        $VsixUrl = $Logs.item($Logs.indexOf('Files:') + 1)
        $VsixName = (Split-Path $VsixUrl -Leaf).TrimEnd('.vsix')
    }
    catch{
        throw "An error has occurred retrieving VSCode extension"
    }
    
    $VsixPath = Join-Path (Split-Path (Get-TFSConfigPath) -Parent) $VsixName
    $VsixFile = (Join-Path -Path $VsixPath -ChildPath $VsixName) + '.vsix'
    if(Test-Path $VsixPath){
        Remove-Item $VsixPath -Recurse -Force
    }
    New-Item -Path $VsixPath -ItemType Directory | Out-Null
    try {
        Download-File -sourceUrl $VsixUrl -destinationFile $VsixFile | Out-Null 
    } 
    catch {
        throw "Unable to download VSCode extension $VsixUrl" 
    }

    $VsixFile 
}

Export-ModuleMember -Function Get-VSCodeExtensionFromContainer