vscode 中用于 tensorflowjs 的智能感知

Intellisense for tensorflowjs in vscode

npm模块@tensorflow/tfjs有声明文件,其注释结构如下:

/**
 * 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;

这导致我的 vs 代码的智能感知显示如下内容:

文档看起来像 jsdoc,只是关闭并重新打开评论可能会破坏它。

由于 tensorflowjs 破坏文档的可能性极小,我可能只是犯了一些非常简单的错误。这很可能是一个骗局。遗憾的是,我所有的搜索都失败了。

just closing and reopening the comment probably breaks it.

100%。它需要是一个单独的评论块。

应该是:

/**
 * 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;

它已在 tfjs 2.4.0 中得到修复,真高兴!