private/Tests/Test-InstallVSCodeInsiders.ps1

function Test-InstallVSCodeInsiders {
    <#
    .SYNOPSIS
        Returns $true when Visual Studio Code Insiders (pre-release channel) is
        installed.
 
    .NOTES
        Author: David Segura
        Company: Recast Software
        Detection: known install paths (per-user, then system-wide), then
        Uninstall registry — DisplayName like 'Microsoft Visual Studio Code Insiders'.
 
    Dependencies: None
    #>

    [OutputType([bool])]
    param ()

    # Fast path — known install locations
    $knownPaths = @(
        (Join-Path $env:LOCALAPPDATA 'Programs\Microsoft VS Code Insiders\Code - Insiders.exe'),
        (Join-Path $env:ProgramFiles  'Microsoft VS Code Insiders\Code - Insiders.exe')
    )
    foreach ($path in $knownPaths) {
        if (Test-Path -Path $path) { return $true }
    }

    # Registry fallback
    $regPaths = @(
        'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
        'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
    )

    foreach ($regPath in $regPaths) {
        $entry = Get-ItemProperty -Path $regPath -ErrorAction SilentlyContinue |
            Where-Object { $_.PSObject.Properties['DisplayName'] -and $_.DisplayName -like 'Microsoft Visual Studio Code Insiders' } |
            Select-Object -First 1
        if ($entry) { return $true }
    }

    return $false
}