【问题标题】:How can I enable autocomplete for a global grunt install in Phpstorm?如何在 Phpstorm 中为全局 grunt 安装启用自动完成功能?
【发布时间】:2015-08-24 22:49:18
【问题描述】:

我希望在配置 Gruntfile.js 文件时在 PhpStorm 中获得自动完成功能。
我相信我不会为 grunt 方法(如 grunt.loadNpmTasksgrunt.initConfig 等)获得代码帮助,因为 grunt 全局 安装在我的主目录 /home/user/npm/lib/node_modules 中,并且在我的项目目录中本地不可用。

如何在 phpstorm 中启用代码辅助(自动补全等)?

【问题讨论】:

    标签: phpstorm


    【解决方案1】:

    在最新版本的 PhpStorm (2016.3) 中,执行以下步骤:

    1. 导航到首选项 > 语言和框架 > JavaScript > 库
    2. 按“下载...”按钮。
    3. 确保从顶部的下拉列表中选择了“TypeScript 社区存根”。
    4. 找到并选择“gruntjs”,然后单击“下载并安装”按钮。 IDE 将下载类型定义文件,完成后窗口将关闭。
    5. 确保选中“gruntjs-DefinitelyTyped”旁边的复选框,然后按“确定”。

    接下来,打开您的 Gruntfile.js 并在顶部添加以下 docblock,就在 module.exports 行之前:

    /**
     * @param {IGrunt} grunt
     */
    module.exports = function (grunt) {
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-19
      • 2012-06-26
      • 2015-09-13
      相关资源
      最近更新 更多