【问题标题】:Getting auto-complete in VSCode for JSX attribute values of 3rd parties在 VSCode 中为 3rd 方的 JSX 属性值自动完成
【发布时间】:2019-02-07 11:19:43
【问题描述】:

我开始使用react-native-animatable。它类似于Animate.css,为 React Native 提供了许多预定义的动画。记住所有不同的动画名称很棘手,我如何在 VSCode 中为不同的动画名称设置自动完成:

该项目有一个definition file。我没有使用 Typescript,但我想自动完成不会介意,对吧?如何设置?

到目前为止我已经尝试过:

我在根目录中添加了一个名为 tsconfig.json 的文件:

{
    "allowJs": true,
    "compilerOptions": {
        "noUnusedLocals": true,
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "sourceMap": true
    },
    "files": ["typings/react-native-animatable.d"]
}

我已将第 3 方的定义复制到名为“typings”的目录中。

还是没有运气。

【问题讨论】:

  • 由于项目有定义文件,您不需要创建该 tsconfig 文件。您是否获得属性名称的智能感知?您如何在代码中导入 Animatable
  • 我使用 import * as Animatable from 'react-native-animatable';

标签: autocomplete visual-studio-code


【解决方案1】:

我很确定类型定义文件以.d.ts 结尾虽然我不确定确切的问题或解决方案是什么this page - under the 'quick fix' heading 可能会为您指明正确的方向。

【讨论】:

    【解决方案2】:

    我在 16.11 react 中遇到了这个问题,但是通过在 node_modules 的 react 文件夹中粘贴三个文件:它们是 index.d.ts、experimental.d.ts 和 global.d.ts。我从我的旧项目中得到这些,它是 16.9 反应。

    【讨论】:

      猜你喜欢
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 2022-07-28
      • 1970-01-01
      • 1970-01-01
      • 2020-02-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多