当我使用Visual Studio Code编写node.js时,我得到了一些简单但非常有用的代码完成建议。例如,如果有回调,它会告诉我签名以及参数的类型。
我也想在自编代码中使用它。我能做些什么来使VS Code能够提供有意义的代码完成建议?
例如。使用快递,我得到的第三方库
但是在创建的方法中,我得到以下内容,而不是那么有用的弹出窗口。
exports.getLastPrice =(market,callback)=> {... callback(result1,result2)}
我该怎么做才能得到关于我自己代码的好建议?谢谢!
编辑:用截图改进了问题
如果您提供,VS Code将使用Javascript文档字符串。例如:
/**
*
* @param {string} param1
* @param {function(number, string):string} callback
*/
function method1(param1, callback) {
callback(result1, result2)
}
...给我代码完成帮助,如下所示:
Docstring在这里有详细记载:http://usejsdoc.org。这就是你要追求的吗?