-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recalling a previous command via PSReadLine in VScode with oh-my-posh 19.18.0 is unusable if using the executiontime
segment
#4786
Comments
@sba923 does this happen outside of vscode? Because nothing changed on that end for a long time. |
No, it doesn't. |
Ok, so there no difference in what oh-my-posh does. VSCode however injects its own script when enabling shell integration, so disable that and see if the issue persists. |
What exact script are you referring to? Do you know how to disable it? |
It's this feature I'm referring to. |
I hate to say, but this doesn't solve the issue. It seems to be theme-dependent. The issue shows up as soon as I add this to my custom theme: {
"background": "#83769c",
"foreground": "#ffffff",
"properties": {
"always_enabled": true
},
"template": "\u231b{{ .FormattedMs }}\u2800",
"powerline_symbol": "\ue0b0",
"style":"powerline",
"type": "executiontime"
}, So (apologies, will edit the title and description of the issue), this is not related to a recent |
executiontime
segment
Current workaround in my if ($host.Name -match 'Visual Studio Code Host')
{
# VScode doesn't like oh-my-posh's "executiontime"
Write-Host -ForegroundColor Yellow 'Creating temp oh-my-posh theme file for VScode'
$theme = Get-Content ($env:PSHOME + '\PowerShell\oh-my-posh\Themes\sba.json') | ConvertFrom-Json
$theme.blocks = $theme.blocks | Foreach-Object {
$_.segments = $_.segments | Where-Object { $_.type -ne "executiontime" }
$_
}
$themefile = Join-Path -Path $env:TEMP -ChildPath 'sba-no-executiontime_oh-my-posh_theme.json'
$theme | ConvertTo-Json -Depth 10 | Out-File -LiteralPath $themefile
oh-my-posh init pwsh --config $themefile | Invoke-Expression
}
else
{
oh-my-posh init pwsh --config ($env:PSHOME + '\PowerShell\oh-my-posh\Themes\sba.json') | Invoke-Expression
}
|
@sba923 the segment can't be the issue but the glyphs can. Try removing those from the template and see if the issue persists. |
Bingo! That same thought had occurred to be, BTW. Replacing Now this could be a font issue (I'm using CaskadiaCove NF), an issue with the extension... Given that it's VScode only, I'll file an issue at https://github.com/PowerShell/vscode-powershell/issues. Changed my workaround to: if ($host.Name -match 'Visual Studio Code Host')
{
# VScode doesn't like the "hourglass" (U+231B) glyph
Write-Host -ForegroundColor Yellow 'Creating temp oh-my-posh theme file for VScode'
$theme = (Get-Content ($env:PSHOME + '\PowerShell\oh-my-posh\Themes\sba.json')) -replace '\\u231b', "" | ConvertFrom-Json
$themefile = Join-Path -Path $env:TEMP -ChildPath 'sba-no-hourglass_oh-my-posh_theme.json'
$theme | ConvertTo-Json -Depth 10 | Out-File -LiteralPath $themefile
oh-my-posh init pwsh --config $themefile | Invoke-Expression
}
else
{
oh-my-posh init pwsh --config ($env:PSHOME + '\PowerShell\oh-my-posh\Themes\sba.json') | Invoke-Expression
} |
@sba923 closing this as we can't solve that here. It's definitely a terminal issue, nothing a font can solve. |
Sure. To be continued at PowerShell/vscode-powershell#4948 |
Code of Conduct
What happened?
Since I added the
executiontime
segment to my custom theme, recalling and editing previous commands withPSReadLine
within the VScode terminal has become... unusable.Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output
The text was updated successfully, but these errors were encountered: