Closed sba923 closed 7 months ago
@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 oh-my-posh
change, but to me adding this to my theme.
Current workaround in my profile.ps1
, FWIW:
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 U+231B
(Hourglass) with something else makes the problem disappear.
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.
@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 https://github.com/PowerShell/vscode-powershell/issues/4948
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
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