Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDE autocompletion for javascript AMD loading style [closed]

Does anyone know of an IDE that can autocomplete javascript AMD style :

// my dojoConfig defined aliases to the packages I use (dojo, dmidz)
// so in dmidz/my-module.js
define(['dojo/dom-construct'], function(cons){// requiring some dojo module
   cons.// <- oh it is nicely displaying list of dom-construct module methods
});

Please don't just give the best, cool IDE you like. I tried Komodo and Webstorm, I just couldn't make them work, or maybe I had not configured them correctly...but none give the possibility to set the same alias as in dojoConfig (too difficult?). For example in Webstorm, there is a library concept, I added dojo and my package, but no way, of course, how it could without knowing the alias paths. There is also a Path Variables concept, no way to understand how it works, the documentation is so poor!

Thank for any help.

like image 403
dmidz Avatar asked Aug 12 '13 10:08

dmidz


2 Answers

You might be looking for TernJS. It declares support of RequireJS via a plugin

It is the best tool I know for the job. Tern is rather RAM-hungry, though (compared to a pure text editor). Integration with Sublime Text is seamless, and with other Sublime plugins you can bring it quite close to a definition of IDE.

Below is an excerpt from TernJS documentation:

Tern is a stand-alone code-analysis engine for JavaScript. It is intended to be used with a code editor plugin to enhance the editor's support for intelligent JavaScript editing. Features provided are:

  • Autocompletion on variables and properties
  • Function argument hints
  • Querying the type of an expression
  • Finding the definition of something
  • Automatic refactoring

Tern is open-source (MIT license), written in JavaScript, and capable of running both on node.js and in the browser. Editor plugins

There is currently Tern support for the following editors:

  • Emacs
  • Vim
  • Sublime Text
  • Brackets (built in to the base editor)
like image 58
Baradzed Avatar answered Nov 15 '22 12:11

Baradzed


Well I am using PHPStorm 8.1 (Webstorm should be ok also) now and... AMD autocompletion works well ! I just declare my js packages as javascript libraries :

Settings > Languages & Frameworks > JavaScript > Libraries > Add...

add and point to each of your packages'folder and enjoy :) Have to mention JetBrains IDE rocks, give it a try, sure you will adopt it since - at least - it resolves AMD style...

like image 33
dmidz Avatar answered Nov 15 '22 11:11

dmidz