Ember 注入服务的智能感知

Urs*_*ili 5 intellisense webstorm ember.js ember-cli visual-studio-code

我有点沮丧,在任何常见的 IDE(如 VS Code、Webstorm、Atom)中似乎都没有任何像样的“Ember 智能感知”。通过“智能感知”,我的意思是,只要我的 Ember 项目是一个标准的 Ember CLI 项目,其中包含所有常见的服务、帮助程序文件夹等,并且我注入了一个服务myService: service(),例如使用,这将被智能感知识别,并且在输入后this.myService,我会看到服务中的所有功能。此外,如果我 Ctrl+单击 中的函数this.myService.myFunction(),我希望导航到 myFunction 的定义。

对于其他框架,例如 Angular,有支持所有这些的插件。

Is it really the case that I have to use "Find in Files" to find the definition of a service function?

Does anyone know of a way or tool which I might have missed, and which would support this scenario? Note that I don't speak of bare-bones features such as switching between router/controller/template, but of real intellisense for custom objects.

Chr*_*cho 3

情况确实还不太妙。有几件事确实有很大帮助:

  • 通过ember-cli-typescript 项目使用 TypeScript将为您带来许多好处。(完全披露:我是维护者。)
  • 有一个社区驱动的 IntelliJ 插件,非常好,intellij-emberj;它具有相当多的这些功能,并且由 Ember CLI 团队的成员保持最新状态。
  • 有一套VS Code 插件,包括一个语言服务器,它提供了相当多的功能。

(这里当然还有很多工作要做,不幸的是,似乎没有一个 IDE 开发人员对自己提供本机支持感兴趣,因此社区负责构建这一切。)