Intellisense for tensorflowjs in vscode

Viewed 340

The npm module @tensorflow/tfjs has declaration files, which have a comment structure like this:

/**
 * Creates a new array with randomized indicies to a given quantity.
 *
 * ```js
 * const randomTen = tf.util.createShuffledIndices(10);
 * console.log(randomTen);
 * ```
 *
 * @param number Quantity of how many shuffled indicies to create.
 */
/** @doc {heading: 'Util', namespace: 'util'} */
export declare function createShuffledIndices(n: number): Uint32Array;

which causes the intellisense of my vs-code to show something like this:

undesired tooltip

The documentation looks something like jsdoc, just closing and reopening the comment probably breaks it.

As it's extremely unlikely, that tensorflowjs has broken documentation, i am probably just making some very simple mistake. There is very likely a dupe for this. Sadly, all my searches failed.

2 Answers

just closing and reopening the comment probably breaks it.

100%. It needs to be a single comment block.

Should be:

/**
 * Creates a new array with randomized indicies to a given quantity.
 *
 * ```js
 * const randomTen = tf.util.createShuffledIndices(10);
 * console.log(randomTen);
 * ```
 *
 * @param n Quantity of how many shuffled indicies to create.
 */
export declare function createShuffledIndices(n: number): Uint32Array;

It got fixed in tfjs 2.4.0, rejoice!

Related