2017-02-09 114 views
3

有沒有辦法讓光標移動到x:10,上時,它會顯示Point.prototype.x的JSdoc。目標是具有相同的JSdoc,比當我將鼠標移過pt.x時更多。Visual Studio代碼:顯示JSdoc的屬性

如果使用當前版本的Visual Studio代碼無法實現,是否可以通過編寫自己的擴展來實現?如果是這樣,vscode命名空間API的哪一部分與此有關?

enter image description here

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; 

回答

0

我於JavaScript和VSCode打字稿支持工作。

這看起來像一個錯誤。我已打開this issue against TypeScript來跟蹤此情況。

一旦問題在TypeScript中得到解決,您可以通過安裝夜間TypeScript內部版本(npm install [email protected])和以下these instructions來配置您的工作空間來試用它。

下面是VSCode的TypeScript和JavaScript懸停實現方案,如果您感興趣:https://github.com/Microsoft/vscode/blob/master/extensions/typescript/src/features/hoverProvider.ts所有語言功能都來自於TypeScript服務器。