Issue Type: Bug
Hey all, in vscode when I type
##
In the line above a function it nicely generates comment-based help, with the parameters of my function included.
However this does not seem to work for documenting a script, for instance with the following starting my script;
[CmdletBinding()]
param (
[string]$Param1 = "5.2.0",
[string]$Param2
)
it won't generate any help
Extension version: 2020.6.0
VS Code version: Code 1.49.3 (2af051012b66169dde0c4dfae3f5ef48f787ff69, 2020-10-02T17:57:01.595Z)
OS version: Windows_NT x64 10.0.18363
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592)|
|GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|63.85GB (45.97GB free)|
|Process Argv||
|Screen Reader|no|
|VM|33%|
I'm not familiar enough with the code here to say exactly how this detection works, but I'd guess it's probably either regex or AST-based detection.
I'm reasonably sure that in just about any case, it should be possible to augment the detection such that basically any scriptblock (including top-level scripts) would register ## and let you provide comment based help. Whether we'd want that restricted a little after that would be probably a good bit easier to determine (almost definitely don't want it for scriptblocks passed as parameters like with Invoke-Command or ForEach-Object, for example).
Comment-based help completion is actually provided by PSScriptAnalyzer's ProvideCommentHelp rule. Anyway, more details are in the linked issue
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.
Most helpful comment
Comment-based help completion is actually provided by PSScriptAnalyzer's ProvideCommentHelp rule. Anyway, more details are in the linked issue