【问题标题】:VSCode - module.exports autocomplete in another fileVSCode - module.exports 在另一个文件中自动完成
【发布时间】:2019-07-31 10:56:27
【问题描述】:

主 JS 文件有这样的代码:

bot.on('message', msg => {
    var cmd = require("./commands/test.js");
    cmd.run(bot, msg);
});

当我输入“味精”时。如果事件(上面的代码)VSCode 显示如下自动完成建议:Autocomplete in main js file (Image)

exports.run = function run(bot, msg) {

}

当我输入“味精”时。在另一个使用 module.exports 的文件(上面的代码)中,自动完成建议不显示:Autocomplete in another file (Image)

有没有办法解决这个问题?

我正在使用 VSCode 版本:1.32.1

【问题讨论】:

  • 你可以JSDoc它,它会再次工作

标签: autocomplete visual-studio-code intellisense discord.js


【解决方案1】:

您可以使用 JSDocs 再次进行自动完成:

const Discord = require('discord.js');

/**
 *
 * @param {Discord.Client} bot
 * @param {Discord.Message} msg
 */
exports.run = function run(bot, msg) {

}

【讨论】:

    猜你喜欢
    • 2019-06-27
    • 1970-01-01
    • 2020-04-22
    • 2022-01-17
    • 2022-01-12
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 2022-06-02
    相关资源
    最近更新 更多