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

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

Open
5 of 6 tasks
mklement0 opened this issue Jan 29, 2024 · 1 comment
Labels

Comments

@mklement0
Copy link
Contributor

mklement0 commented Jan 29, 2024

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](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Comment_Based_Help) is seemingly not consulted.

* The formatting of their syntax diagrams is broken: they 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

@mklement0 mklement0 added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Jan 29, 2024
@mklement0 mklement0 changed the title IntelliSense doesn't honor comment-based help for _script files_ (.ps1), absent or broken syntax diagrams IntelliSense doesn't honor comment-based help for script files (.ps1), absent or broken syntax diagrams Jan 29, 2024
@JustinGrote
Copy link
Collaborator

Thanks, I'm hoping to take a look at hovers in general so I'll try to take a peek at this as well.

@SydneyhSmith SydneyhSmith added Area-IntelliSense and removed Needs: Triage Maintainer attention needed! labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants