Containers/Get-ContainerFromLaunchJson.ps1

<#
 .Synopsis
  Disables symbol loading in container
 .Description
  Disables symbol loading in container
 .Parameter ContainerName
  Name of the container. Can be provided in the settings.json
 .Parameter SourcePath
  Path to the current project
 .Example
  Disable-SymbolLoading
#>

function Get-ContainerFromLaunchJson {
    param (
        # Path to launch.json
        [Parameter(Mandatory=$false)]
        [string]
        $LaunchJsonPath = (Join-Path (Get-Location) '.vscode\launch.json')
    )

    if (!(Test-Path $LaunchJsonPath)) {
        return ''
    }

    $LaunchJson = ConvertFrom-Json (Get-Content $LaunchJsonPath -Raw)
    if ($LaunchJson.configurations.Count -lt 1) {
        return ''
    }
    else {
        $Container = $LaunchJson.configurations.Item(0).server
        $Container = $Container.Substring($Container.IndexOf('//') + 2)
        $Container
    }
}

Export-ModuleMember -Function Get-ContainerFromLaunchJson