refactor: align debug functionality cross shell

This commit is contained in:
Jan De Dobbeleer 2022-04-06 13:45:07 +02:00 committed by Jan De Dobbeleer
parent 3a15594410
commit f937f28545
3 changed files with 6 additions and 23 deletions

View file

@ -56,7 +56,7 @@ body:
id: logs
attributes:
label: Log output
description: Please copy and paste the output generated by `Write-PoshDebug (PowerShell)`, or `oh-my-posh debug` for other shells.
render: shell
description: Please copy and paste the output generated by `oh-my-posh debug`.
render: Shell
validations:
required: true

View file

@ -21,34 +21,21 @@ Before validating anything, make sure you're on the [latest version][latest] of
}>
<TabItem value="powershell">
You can use the `Write-PoshDebug` function to see where Oh my posh spends its time.
You can use the `oh-my-posh debug` functionality to see where Oh My Posh spends its time.
In case there's no clear culprit (timings indicate everything's OK), chances are some modules are the culprit.
We bootstrap a few PowerShell modules to maximise compatibility, but sometimes these can introduce unwanted side-effects.
The modules we support are:
- posh-git
- Az.Accounts
Especially the latter can slow things down so the first thing to do is disable that one:
```powershell
$env:AZ_ENABLED=$false
```
Once added, reload your profile for the changes to take effect.
```powershell
. $PROFILE
```
</TabItem>
<TabItem value="others">
You can use the Oh My Posh's built-in `--debug` flag to identify slow segments.
You can use Oh My Posh's built-in debug functionality to identify slow segments.
```bash
oh-my-posh --config ~/.mytheme.omp.json --debug --shell uni
oh-my-posh debug
```
Whenever there's a segment that spikes, see if there might be updates to the underlying functionality (usually shell commands).

View file

@ -124,10 +124,6 @@ function global:Initialize-ModuleSupport {
}
Set-Item -Path Function:prompt -Value $Prompt -Force
function global:Write-PoshDebug {
@(Start-Utf8Process "::OMP::" "debug") -join "`n"
}
<#
.SYNOPSIS
Exports the current oh-my-posh theme