microsoft / inshellisense

IDE style command line auto complete
MIT License
8.45k stars 187 forks source link

Prompt doesn't show when oh-my-posh is initialized #267

Closed Ripwords closed 2 months ago

Ripwords commented 3 months ago

Describe the bug Just installed it and tried to use it but no prompt was showing up. So i went to my pwsh $PROFILE and removed my oh-my-posh config and the prompts were working. I tried moving the oh-my-posh line to both before and after the inshellisense script but there's not really difference

image

image

To Reproduce Steps to reproduce the behavior:

  1. Installed inshellisense
  2. Use windows terminal with pwsh 7
  3. Try inshellisense with oh-my-posh and without

Expected behavior Inshellisense prompts to show up

Environment

Additional context My pwsh $Profile

# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {Import-Module "$ChocolateyProfile"}
Remove-Alias -Name ni -Force
Set-PSReadLineOption -PredictionSource None

# ---------------- inshellisense shell plugin ----------------
$__IsCommandFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-Command") }) -contains $true
$__IsNoExitFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-NoExit") }) -contains $true
$__IsInteractive = -not $__IsCommandFlag -or ($__IsCommandFlag -and $__IsNoExitFlag)
if ([string]::IsNullOrEmpty($env:ISTERM) -and [Environment]::UserInteractive -and $__IsInteractive) {
  is -s pwsh
  Stop-Process -Id $pid
}

oh-my-posh init pwsh --config 'C:\Users\teohj\AppData\Local\Programs\oh-my-posh\themes\agnosterplus.omp.json' | Invoke-Expression
cpendery commented 2 months ago

The inshellisense shell plugin needs to be at the very bottom of the file, after your oh-my-posh init command. That should fix your issue

cpendery commented 2 months ago

I've emphasized this detail in the readme in #279