使用JetBrains WebStorm进行Firefox插件开发。如何处理大量的警告? [英] Firefox addon development using JetBrains WebStorm. What to do with numerous warnings?

查看:286
本文介绍了使用JetBrains WebStorm进行Firefox插件开发。如何处理大量的警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在开发一个Firefox插件。我已经尝试了很多JavaScript的IDE,最后结束了与JetBrains WebStorm。
但是当我在WebStorm中打开我的项目(大约1000行)时,第一次向我展示了大约500条警告。大多数警告是未解析的函数或方法和未解析的变量或类型。

例如,这两行包含4个警告:

  let sss = Cc [@ mozilla.org/content/style-sheet-service;1\"].getService(Ci.nsIStyleSheetService); 
sss.loadAndRegisterSheet(uri,sss.AUTHOR_SHEET);




  1. getService(未解析的函数或方法)
  2. nsIStyleSheetService(未解析变量)
  3. loadAndRegisterSheet(未解析函数或方法)
  4. AUTHOR_SHEET(未解析变量)

现在我只是禁用了所有这些警告。但也许这不是处理这个问题的最好方法吗? WebStorm中有jQuery,Ext JS,Prototype,Dojo等的库。并且可以添加一个定制的JavaScript库。有没有办法添加/创建这样的自定义库?或者还有另一种方法来处理所有这些警告,而不是禁用它们?

有Komodo IDE提供这样的自动完成功能:


我想也许有人从Komodo IDE中提取它并添加到WebStorm作为一个库。

解决方案

我已经通过克隆 repository ,然后在设置 - >语言和文件夹下添加lib / sdk目录作为新的库。 Frameworks-> JavaScript-> Libraries。


I am developing a firefox addon now. I have tried a lot of IDEs for JavaScript and finally ended up with JetBrains WebStorm. But when I opened my project(about 1000 lines) in WebStorm the first time it showed me about 500 warnings. The most of the warnings are "Unresolved function or method" and "Unresolved variable or type".

For example this 2 lines contain 4 warnings:

let sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
sss.loadAndRegisterSheet(uri, sss.AUTHOR_SHEET);

  1. getService (Unresolved function or method)
  2. nsIStyleSheetService (Unresolved variable)
  3. loadAndRegisterSheet (Unresolved function or method)
  4. AUTHOR_SHEET (Unresolved variable)

For now I just disabled all this warnings. But maybe it's not the best way to handle the problem? There are "libraries" in WebStorm for jQuery, Ext JS, Prototype, Dojo and other. And a custom JavaScript library can be added. Is there a way to add/create such a custom library? Or is there another way to handle all this warning not disabling them at all?

P.S. There's Komodo IDE that provides such autocompletions:

and I thought that maybe someone extracted it from Komodo IDE and added to WebStorm as a library.

解决方案

I have solved the issue by cloning the repository and adding the lib/sdk directory as a new library under Settings->Languages & Frameworks->JavaScript->Libraries.

这篇关于使用JetBrains WebStorm进行Firefox插件开发。如何处理大量的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆