Showing usage help as part of tooltips

Is there any way to import the comments associated with properties/functions that are imported from a DLL when using the JavaScript parser?

i.e. Here is what the tooltip shows in the demo application:

Here is what I see in Visual Studio:

It would be great if there is some sort of option or additional call I can make in my code that would enable this.

Hi Andrew,

JavaScript/TypeScript parsers have built-in support for JavaDocs, so it will display descriptions for method/ method parameters if they’re defined.


/**
Converts a level name or value to a {@link logging.Level} value.
If the name/value is not recognized, {@link logging.Level.ALL} will be returned.
@param {(number|string)} nameOrValue The log level name, or value to convert .
@return {!logging.Level} The converted level.
*/
function getLevel(nameOrValue : string | number) : number {
    return 0;
    getLevel(1); // this will show signature help with parameter descriptions
}

The problem for types/methods coming from .NET Framework is that we do not include these JavaDoc comments when we generate .d.ts files. One of the reason that will make these d.ts files a lot larger and most likely will affect performance of code parsing and script execution.

We do have a support for descriptions for .NET classes, but not for immediate release.

From initial investigation there seem to be these two options here - one is to put java docs in the generated .d.ts files (provided that performance impact is tolerable), another one - is to load descriptions on-demand (this is what we do for our advanced C# parsers in DescriptionHelper class - by locating .NET xml files and loading/parsing their content).
In both cases there should be xml files to start with (from memory they’re only installed with .NET SDK, not with .NET Framework itself).

Second approach so far look more promising, however SignatureHelpItems returned by TypeScript service, does not seem to contain a qualified name of the symbol to the left of the method, only names of the methods and parameters, so in order to construct a lookup key we might need to do another call to the parser to find out this qualified name.

Let me know how soon you need this feature and we work on it sooner if needed.

Kind regards,
Dmitry

I’m actually more interested in showing help for the few dozen methods exposed from my own DLL rather than exposing everything from the .NET framework. Comments in my classes use the standard triple-slash format:

/// <summary>
/// Gets the current time
/// </summary>
public DateTime GetCurrentTime()
{
    return DateTime.Now;
}

It would be great if there was an option to convert these comments into JavaDocs format and include them in the .d.ts files. It could be turned off by default so that it doesn’t impact size/performance unless the developer makes a choice to turn it on and live with the impact.

This is not particularly urgent, just a nice to have when/if you guys have time to implement it.

Hi Andrew,

We will look at what’s required to generate these JavaDocs and I will get back to you.

Regards,
Dmitry

1 Like

Hi Andrew,

This should work now, please refer to the following post:

Regards,
Dmitry