Remove the need to annotate Lightning controller methods

Issue #1042 resolved
Andrew Visser created an issue

Steps

  • Create a Lightning component & controller
  • create a method doInit: function(cmp, event, helper)
  • Start typing in the body cmp.

Expected results: I see the autocomplete results from your docs in Component.js

Actual: I see the generic IntelliJ guesses for autocomplete

As I noted in https://bitbucket.org/RoseSilverSoftware/illuminatedcloud/issues/1041/include-type-hints-in-jsdocs-for-lightning, the workaround is to annotate the method and include the type info (@param cmp {Component})

It would be awesome if I didn't need to annotate controller methods with type information.

If Intellij does not provide the hooks/APIs to inject that information, perhaps create a workflow where it's easy to create & hide

Comments (3)

  1. Scott Wells repo owner

    Andy, I certainly understand the request, but this is pretty much how IntelliJ IDEA Ultimate Edition/WebStorm's JavaScript editor works. Given the dynamic nature of JavaScript, it performs as much type inference as it can given all of the information available to it. In the case of raw JavaScript (as opposed to TypeScript, etc.), JSDoc with type information becomes a critical source of type inference information.

    I'll keep this request open and research whether there's a sanctioned way to supplement the base IDE's JavaScript type inference engine so that certain patterns are auto-recognized, e.g., component and cmp as Component, evt and event as Event, etc., as if they'd been annotated that way, but honestly that makes me quite nervous because of the possibility of an incorrect inference.

  2. Log in to comment