我试图让 intellij 识别我的 module.exports 对象的 jsdocs。它不断为我提供用于 Crtl + Q
文档预览的推断类型:函数
。
编辑:尝试添加来自@dez的@name module.exports.nameToUpperCase
建议
'use strict';
/**
* Uppercases supplied name.
* @name module.exports.nameToUpperCase
* @param name {string} The name to uppercase
* @returns {string} Uppercase version of the supplied name
*/
var nameToUpperCase = function (name) {
return name.toUpperCase();
};
module.exports = {
nameToUpperCase: nameToUpperCase
};
我还查看了 jsdocs,但似乎唯一的示例是这样做:
'use strict';
/**
* Uppercases supplied name.
* @param name {string} The name to uppercase
* @returns {string} Uppercase version of the supplied name
*/
module.exports.nameToUpperCase = function (name) {
return name.toUpperCase();
};
但是我试图让它显示为第一个方法,因为我的导出对象有很多方法。
最佳答案
所以我昨天向 intellij 发送了一张票,就在我发布问题的同一天。今天他们回复说我应该下载 IDEA 15,目前处于测试阶段,因为他们在我的请求中添加了该功能...我尝试了,它有效...快速响应和功能构建。 Intellij ftw。
'use strict';
/**
* Uppercases supplied name.
* @name module.exports.nameToUpperCase
* @param name {string} The name to uppercase
* @returns {string} Uppercase version of the supplied name
*/
var nameToUpperCase = function (name) {
return name.toUpperCase();
};
module.exports = {
nameToUpperCase: nameToUpperCase
};
现在可以按预期工作了!
关于javascript - 如何在Intellij中jsDoc Node module.exports对象方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31925637/