Skip to content
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

Long completion tooltips freezes the console for a while #4020

Open
3 tasks done
MartinGC94 opened this issue May 21, 2024 · 0 comments
Open
3 tasks done

Long completion tooltips freezes the console for a while #4020

MartinGC94 opened this issue May 21, 2024 · 0 comments
Labels
Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.

Comments

@MartinGC94
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

N/A

Environment data

PS Version: 7.5.0-preview.2
PS HostName: ConsoleHost
PSReadLine Version: 2.3.4
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 282
BufferHeight: 9001

Steps to reproduce

  1. Register an argument completer where at least one of the completions has a really long tooltip
  2. Trigger it with menu completion (Ctrl+Space)
  3. Watch the console freeze and CPU usage rise as the long string is processed

Here's an example of this:

Register-ArgumentCompleter -CommandName Get-ChildItem -ParameterName Filter -ScriptBlock {
    [System.Management.Automation.CompletionResult]::new("CompletionText", "ListItem", [System.Management.Automation.CompletionResultType]::ParameterValue, "T$("o" * 1mb)ltip")
    [System.Management.Automation.CompletionResult]::new("OtherRes1", "OtherRes2", [System.Management.Automation.CompletionResultType]::ParameterValue, "OtherRes3")
}
Get-ChildItem -Filter <Ctrl+Space>

If you wait for it to fully load and move the cursor over to the second result and then back it will freeze again.

Obviously this is a silly example but PowerShell can generate really long tooltips in more realistic scenarios. For example if you parse a long script and hover over the scriptblock Ast the tooltip will contain the entire script, so if you've parsed a really big script you will see this freeze.

Expected behavior

No freezes and a truncated tooltip is visible.

Actual behavior

Freeze for several seconds and no tooltip.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.
Projects
None yet
Development

No branches or pull requests

1 participant