visual-studiovisual-studio-2022posh-gitoh-my-posh

Package Manager Console prompt is messed up after installing oh-my-posh


I have oh-my-posh and posh-git installed and added to my Powershell profile, which looks like this

Import-Module posh-git
Import-Module oh-my-posh
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\thecyberden.omp.json" | Invoke-Expression

I'm using the CaskaydiaCove NF font in Powershell, which I also set as the font for the Package Manager Console.

enter image description here

My Windows Terminal prompt is correct:

enter image description here

However, the Package Manager Console in Visual Studio is weird, like it's not able to find the correct glyphs:

enter image description here

Is there a way to fix my Package Manager Console prompt so that either it displays correctly like Powershell, or so that it ignores the Powershell profile and just uses its default prompt?


Solution

  • Ok, its already some time since problem was reported. I had same issue and found a workaround. I changed my Profile.ps1 like this:

    $vsprofile = oh-my-posh get shell
    if ($vsprofile -ne "devenv") {
      oh-my-posh init pwsh | Invoke-Expression
      Import-Module -Name Terminal-Icons  
    }
    

    It may be thats an ugly hack, but provides oh-my-posh via Windows Terminal and prevents it in Visual Studio Package. However as soon as Visual Studio is lauched, ist seems that the Environment Variable is set system wide and thus all pwsh started after VS don't get oh-my-posh activated.