Method / Class Comments with Intellisense

I have written a PowerShell Class with static methods. It works quite swiftly and efficiently.

I would like the ability to add comments to the Class and the Methods which will appear in an IDE (e.g. VScode) while writing Advanced Functions that use the Class. In Python one can surround the comments with three single quotes (’’‘comment’’’) as shown below. Those comments appear in VScode when writing against the class/function.

Is there a Methodology (wink) for this in PowerShell? If so, what is it? I’ve tried /// and # and ‘’’ to no avail.

Thanks,
JoeyA

Python…
class MyClass():

‘’‘My Comments Here’’’

def my_function:

‘’‘More comments here’’’

PowerShell…
Class myClass
{
# Comments here that are used by Intellisense?
static [hashtable] myMethod ([string] $myVar)
# Comments here that are used by Intellisense
{}
}

@Joe Acosta
Below Article might help you
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help?view=powershell-5.1

Thanks,
Nitesh Bhat

The link does not mention classes, methods, or how to make comments for them that appear in intellisense. So no, not at all helpful. Thanks tho.

Why not just look at the PowerShell classes MS provides that are already on your system as the examples to follow for your use case, or jump out to the PowerShell Core OSS repo and look at the source code for all the cmdlet for examples?

This ’ /// ’ of course is not how you do comments in PowerShell proper. There is on ‘#’ or ‘<##>’ , though the .Net stuff (C#, etc.) does use that, thus, well, you know.

See also:

Comment-based Help for classes
https://github.com/PowerShell/PowerShell/issues/2225

How To Document Your PowerShell Library
https://www.red-gate.com/simple-talk/sysadmin/powershell/how-to-document-your-powershell-library

 

You’re looking for the Insert XML Comments functionality to give you in-line IntelliSense descriptions. JavaScript has a similar feature called JSDoc. Unfortunately, this is a language-specific feature and even though PowerShell borrows some syntax from C# it does not include this feature.

@grokkit - thanks for the response. I came to the same conclusion, but thought I would ask just in case I missed something simple. Fortunately its not a major item. Thanks again!