Long completion tooltips freezes the console for a while

Abierto
#4,020 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
50/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
csharp, powershell
Área
cli

Línea de trabajo

Reproduce the issue with Register-ArgumentCompleter and menu completion via Ctrl+Space, using the long-tooltip example in the report. Trace the completion tooltip handling and verify that long tooltips are truncated, the console remains responsive, and the second completion can be selected without another freeze.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Needs-Triage :mag:
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.

Lenguaje dominante
C#
Estrellas
4.4k
Forks
341
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PowerShell/PSReadLine

Todos los issues de PowerShell/PSReadLine

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.