0
私はjavascript/jqueryを書くためにVisual Studioを使用しています。例は、私が入力します。javascript/jqueryの宣言とオーバーライド
$('#selector').text('foo')
その後、私はtext
押しF12
を選択します。 VSは私にファイルjquery-2.2.3.intellisense.js
を示し、自動的fucntionにまでスクロールします:
'text': function() {
/// <signature>
/// <summary>Set the content of each element in the set of matched elements to the specified text.</summary>
/// <param name="textString" type="String">A string of text to set as the content of each matched element.</param>
/// <returns type="jQuery" />
/// </signature>
/// <signature>
/// <summary>Set the content of each element in the set of matched elements to the specified text.</summary>
/// <param name="function(index, text)" type="Function">A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.</param>
/// <returns type="jQuery" />
/// </signature>
}
私はそれが唯一の機能の説明が含まれていることを知っています。私もそれをしたい。
ある場所にある説明で関数を宣言し、それを別の場所でオーバーライド(実装)します。
// first
var Add = function (a, b) {
/// <signature>
/// <sumary>Add 2 numbers</sumary>
/// <returns type="Number" />
/// </signature>
};
// second
@override
@**
* Add 2 numbers
* @param {Number} a: Number a
* @param {Number} b: Number b
* @return {Number}
*/
var Add = function (a, b) {
return a + b
};
さて、私が入力したとき:このよう
var sum = Add(2, 3);
私はAdd
を選択し、F12
を押すと、私はVSはthe first
機能(ない秒)に当たると考えたいです。
私の質問:どうしたらいいですか?
私は、ファイルanother.js
で
intellisense.annotate(jQuery, {});
intellisense.annotate(jQuery, {
'Add': function() {
/// <signature>
/// <summary>Add 2 numbers</summary>
/// <param name="a" type="Number">Number a</param>
/// <param name="b" type="Number">Number b</param>
/// <returns type="Number" />
/// </signature>
}
});
にファイルjquery-2.2.3.intellisense.js
と機能をオープンしようとしました
これだけではできません。 – underscore
'visual-studio'であなたの質問にタグを付けるべきです。タグを適切に使用すると、他の人があなたに返答するのに役立ちます。 – cezar