From f937f285456ea52197528eed63b2e16ce4f4c8b9 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 6 Apr 2022 13:45:07 +0200 Subject: [PATCH] refactor: align debug functionality cross shell --- .github/ISSUE_TEMPLATE/bug.yml | 4 ++-- docs/docs/faq.mdx | 21 ++++----------------- src/shell/scripts/omp.ps1 | 4 ---- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 8bc5788f..8166eee7 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -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 diff --git a/docs/docs/faq.mdx b/docs/docs/faq.mdx index d45c4f37..f35a9ead 100644 --- a/docs/docs/faq.mdx +++ b/docs/docs/faq.mdx @@ -21,34 +21,21 @@ Before validating anything, make sure you're on the [latest version][latest] of }> -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 afew PowerShell modules to maximise compatibility, but sometimes these can introduce unwanted side-effects. +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 -``` -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). diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 1d14465d..edf60ba0 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -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