Public/TMD.Debugging.ps1

Function Update-TMDVsCodeLaunchConfig {
    param(
        [Parameter(mandatory = $true, Position = 0)][string]$TmdPsRoot,
        [Parameter(mandatory = $False, Position = 1)][string]$SessionPid,
        [Parameter(mandatory = $False, Position = 1)][string]$SessionRunspaceId,
        [Parameter(mandatory = $False, Position = 2)][switch]$Clear

    )

    ## Get the path for VS Code's Launch file and Open it
    # $LaunchConfigFile = Join-Path $TmdPsRoot '.vscode' 'launch.json'
    $LaunchConfigFile = Join-Path $appPaths.defaultConfig 'launch.json'
    $LaunchConfig = Get-Content -Path $LaunchConfigFile | ConvertFrom-Json

    ## Save Launch Configuration
    ## If the settings should be
    if ($Clear) {

        ## Clear Session Name based config
        $LaunchConfig.configurations[0].args = [array]@('')
        $LaunchConfig.configurations[0].script = ''
    }

    $LaunchConfig | ConvertTo-Json -Depth 5 | Set-Content -Path $LaunchConfigFile
}