PowerShell / PowerShell/vscode-powershell

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

Offen
#4,904 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Area-IntelliSense Issue-Bug
Vorherrschende Sprache
TypeScript
Sterne
1.9k
Forks
548
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Problem mit dem Beispielskript Foo.ps1 zu reproduzieren, und vergleiche die IntelliSense-Ausgabe mit (Get-Help ./Foo.ps1).synopsis und (Get-Help ./Foo.ps1).syntax. Verfolge die Verarbeitung von Hilfe und Syntax für Skriptdateien in der Erweiterung; fertig ist die Aufgabe, wenn die Synopsis erscheint und mehrere Syntaxdiagramme in IntelliSense durch Zeilenumbrüche getrennt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
powershell, vscode
Bereich
developer-experience, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.