Skip to content

Workaround when a module takes too long to run Get-Help #2737

@PrzemyslawKlys

Description

@PrzemyslawKlys

Issue Description

I am experiencing a problem with... Get-Help taking very long time on some modules and impacting PowerShell extension.

Spawned from issue: #2627

Get-Help -Name Merge-CCBranchesBySquash -ErrorAction Ignore

As per @TylerLeonhardt quote:

This is taking like 20 seconds from the logs. (which is what we run to get more information about the command to display next to completions)

As per comment of @SeeminglyScience

It's part of it for sure, but as it turns out they have a pretty solid reason.

Honestly though, even if they had that Get-Help would still take just as long to run probably. Short of a complete overhaul of the completion API's to be based on entirely around static analysis, there's not much that can be done about that.

A workaround would need to consider that we (users) have no clue something is taking a too long time to load. So this would have to be detected and suggested to be ignored.

Possible solution by @TylerLeonhardt

I guess we could offer a setting to disable running Get-Help and just show syntax like we do if no help comes back... but that's sad :(

We could expose our exclusion list(s) via settings:

https://github.com/PowerShell/PowerShellEditorServices/blob/master/src/PowerShellEditorServices/Services/PowerShellContext/Utilities/CommandHelpers.cs#L20-L50

Which basically contain PowerShellGet and PackageManagement atm (to prevent PackageManagement from loading...)

Then you could exclude AWS's cmdlets/noun somehow.

Yeah we can possibly detect how long it takes and recommend ignoring a module...

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19041
VSCode 1.45.1
PowerShell Extension Version 2020.6.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
bracket-pair-colorizer-2 CoenraadS 0.1.4
code-settings-sync Shan 3.4.3
github-linker gimenete 0.2.3
gitlens eamodio 10.2.1
grammarly znck 0.12.1
markdown-all-in-one yzhang 3.0.0
material-icon-theme PKief 4.1.0
powershell-preview ms-vscode 2020.6.0
project-manager alefragnani 11.0.1
vscode-markdownlint DavidAnson 0.36.0
vscode-pull-request-github GitHub 0.16.0
vscode-toggle-quotes BriteSnow 0.3.2
vscode-wakatime WakaTime 4.0.0
xml DotJoshJohnson 2.5.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions