【问题标题】:Visual Studio Code: Display JSdoc for attributeVisual Studio Code:显示属性的 JSdoc
【发布时间】:2017-02-09 01:29:01
【问题描述】:

有没有办法让光标移动到x:10, 上时,会显示Point.prototype.x 的JSdoc。目标是拥有与我将鼠标悬停在 pt.x 上时相同的 JSdoc。

如果当前版本的 Visual Studio Code 无法实现,是否可以通过编写我自己的扩展来实现?如果有,vscode 命名空间 API 的哪一部分与此相关?

class Point {
    /** The x property */
    x:number;
    /** The y property */
    y:number;
}

/** Prints a point. 
 * @param pt The point
*/
function printPoint(pt:Point){
    console.log(pt.x,pt.y);
}

printPoint(<Point>{
    x:10,
    y:10,
});

let pt = new Point();
pt.x;

【问题讨论】:

    标签: typescript visual-studio-code jsdoc vscode-extensions


    【解决方案1】:

    我致力于 VSCode 的 JavaScript 和 TypeScript 支持。

    这看起来像一个错误。我已经打开 this issue against TypeScript 来跟踪这个。

    一旦问题在 TypeScript 中得到解决,您可以通过安装夜间 TypeScript 构建 (npm install typescript@next) 并按照 these instructions 配置您的工作区来进行尝试。

    如果您有兴趣,这里是 VSCode 对 TypeScript 和 JavaScript 的悬停实现:https://github.com/Microsoft/vscode/blob/master/extensions/typescript/src/features/hoverProvider.ts 所有语言功能都来自 TypeScript 服务器。

    【讨论】:

      猜你喜欢
      • 2018-08-15
      • 1970-01-01
      • 1970-01-01
      • 2017-07-31
      • 1970-01-01
      • 2018-09-06
      • 2017-01-24
      • 1970-01-01
      • 2015-11-16
      相关资源
      最近更新 更多