【问题标题】:Intellisense for tensorflowjs in vscodevscode 中用于 tensorflowjs 的 Intellisense
【发布时间】:2020-08-25 13:59:02
【问题描述】:

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 破坏文档的可能性极小,我可能只是犯了一些非常简单的错误。这很可能是一个骗局。很遗憾,我的所有搜索都失败了。

【问题讨论】:

  • As it's extremely unlikely, that tensorflowjs has broken documentation 每个人都会犯错误????

标签: typescript visual-studio-code intellisense jsdoc tensorflow.js


【解决方案1】:

只是关闭并重新打开评论可能会破坏它。

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;

【讨论】:

  • 发现为此打开了issue on github。猜猜是时候进行正则表达式搜索和销毁了,直到它修复,并且新版本稳定。
  • 你可能已经注意到我将@param number(没有参数称为数字)也固定为@param n ?
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2021-07-26
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    • 2020-10-09
    • 1970-01-01
    • 2019-01-10
    • 2022-08-22
    • 2020-05-05
    相关资源
    最近更新 更多