简体   繁体   English

如何在没有“未安装模块”提示的情况下将 Electron 集成到 WebStorm?

[英]How to integrate Electron to WebStorm having no "Module is not installed" hint?

My Electron project works just fine.我的 Electron 项目运行良好。 But I can't go to the declaration of the electron plugin and I can't figure out how to solve that.但是我不能去电子插件的声明,我不知道如何解决。

Basically I just wanna get rid of that hint shown in the image below and instead being able to go to it's declaration.基本上我只想摆脱下图中显示的提示,而是能够转到它的声明。

Module is not installed...未安装模块...

Unresolved function or method...未解决的函数或方法...

Thanks.谢谢。

You'll need to install TypeScript type definitions for Electron, the first section of this blog post explains how to setup code completion for ReactJS in WebStorm:你需要为 Electron 安装 TypeScript 类型定义, 这篇博文的第一部分解释了如何在 WebStorm 中为 ReactJS 设置代码完成:

To enhance code completion with typed parameter information we recommend that you add a TypeScript definition file for react.d.ts as a JavaScript library for the project.为了使用类型化参数信息增强代码完成,我们建议您添加react.d.ts的 TypeScript 定义文件作为项目的 JavaScript 库。

Go to Preferences |转到首选项 | Languages & Frameworks |语言和框架 | JavaScript | JavaScript | Libraries, click Download…, select TypeScript community stubs, search for react and click Download.库,单击下载...,选择 TypeScript 社区存根,搜索 react 并单击下载。 The file will be added as JavaScript library for WebStorm to use in coding assistance.该文件将被添加为 WebStorm 的 JavaScript 库,以用于编码辅助。

You should be able to install the Electron type definitions the same way, keep in mind that the typings for Electron are named github-electron (as opposed to just electron ).您应该能够以相同的方式安装 Electron 类型定义,请记住,Electron 的类型被命名为github-electron (而不仅仅是electron )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM