我知道你可以使用< loc>对于本地化,但它似乎仍然需要正常函数中的XML注释(即重复标记)。我想要做的是像往常一样编写函数,甚至可能没有注释,但是intellisense来自另一个文件。像这样:
MyScript.js
function herp(a) {
return ('merp');
}
function derp(a) {
return ('merp');
}
MyScript.intellisense.js
function herp(a) {
/// <summary>This function herps a flerp.</summary>
/// <param name='a' type='String'>The flerp you want to herp.</param>
/// <returns>The finished herp</returns>
}
function derp(a) {
/// <summary>This function derps a flerp.</summary>
/// <param name='a' type='String'>The flerp you want to derp.</param>
/// <returns>The finished derp</returns>
}
然后,在我的主 site.js 文件中,我可以输入
herp(
并查看工作智能感知。
答案 0 :(得分:0)
所以基本上它可以按照以下结构运行:
<强> functions.intellisense.js 强>
function herp(a) {
/// <summary>This function herps a flerp.</summary>
/// <param name='a' type='String'>The flerp you want to herp.</param>
/// <returns>The finished derp</returns>
}
function derp(a) {
/// <summary>This function derps a flerp.</summary>
/// <param name='a' type='String'>The flerp you want to derp.</param>
/// <returns>The finished derp</returns>
}
<强> functions.js 强>
function herp(a) {
return ('merp');
}
function merp(a) {
return ('merp');
}
site.js (智能感知在此文件中按预期工作)
/// <reference path="functions.intellisense.js" />
window.onload = function () {
alert(herp('test'));
}
<强>的index.html 强>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
Documentation/intellisense test.
<script src="Scripts/functions.js"></script>
<script src="Scripts/site.js"></script>
</body>
</html>