PowerShell / PowerShell/vscode-powershell

IntelliSense doesn't honor comment-based help for script files (`.ps1`), absent or broken syntax diagrams

Aperta
#4,904 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-IntelliSense Issue-Bug
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

IntelliSense with respect to script files (.ps1) that have comment-based help - as opposed to functions - currently has the following problems:

  • Their synopsis is not shown, because their comment-based help is seemingly not consulted.

  • The formatting of their syntax diagrams is broken: the individual diagrams aren't separated with empty lines and instead form one long string without line breaks, resulting in arbitrary line wrapping. Situationally - as in the repro below - no syntax diagrams are shown at all.

PowerShell Version
Name             : Visual Studio Code Host
Version          : 2024.0.0
InstanceId       : 63cceb1e-397a-4b02-989f-55f2c40757c7
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.85.2
8b3775030ed1a69b13e4f4c628c612102e30a681
arm64
Extension Version
ms-vscode.powershell@2024.0.0
Steps to Reproduce
  • Create a sample script with comment-based help and multiple parameter sets.
@'
<#
.SYNOPSIS
Foo's description.
#>
param(
  [Parameter(ParameterSetName='Foo')]
  $Foo,
  [Parameter(ParameterSetName='Bar')]
  $Bar
)
'@ > Foo.ps1
  • Run (Get-Help ./Foo.ps1).synopsis and (Get-Help ./Foo.ps1).syntax to verify that both the comment-based help

  • In Visual Studio Code, in the same folder, type ./Foo in order to show IntelliSense

As the screenshot shows, neither the description nor the syntax diagrams are shown.

Visuals
image
Logs

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema con lo script di esempio Foo.ps1 e confronta l'output di IntelliSense con (Get-Help ./Foo.ps1).synopsis e (Get-Help ./Foo.ps1).syntax. Analizza la gestione della guida e della sintassi dei file di script nell'estensione; il lavoro è completo quando la sinossi viene visualizzata e più diagrammi di sintassi sono separati da interruzioni di riga in IntelliSense.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.