I'm working in a java/eclipse shop writing javascript, coming from a php/netbeans background. So far, I hate eclipse, but I don't want to shift away from the general tool set. (Because of issues with our build system, we're currently on the galileo release.)
The syntax coloring is just fine, and I'm learning to live with the cockpit-like interface, but eclipse's outliner doesn't properly recognize things like the module pattern at all. Nor does it do much auto-completion on my methods. Can I do anything about that?
I tried installing Aptana, but so far, I haven't noticed any real improvements in basic editing. I see the WTP, which I may or may not have installed. (How do I find out? :) Would that help?
While I'm asking, eclipse does a lousy job with indentation, which I'm constantly having to fix, since I care about such things. Anything to be done about that?
Make sure you have installed JavaScript developer tools. See Help / About Eclipse / WTP (one of the icons at the bottom of dialog) / JavaScript Developer Tools feature
Then on your web project Project / Properties / Project Facets page and make sure JavaScript Toolkit facet is selected. After that you should see JavaScript / Code Style / Formatter page as well as other advanced pages, such as, Libraries, Validation, etc.
Use JSdoc. It will give you back outline and autocomplete! Saved my life the other day...
/**
* @type MyModule
* @memberOf __MyModule
*/
var MyModule = (/** @constructor */ function () {
function innerFunc() {
// blub
}
/**
* @memberOf MyModule
*/
api.publicFunc = function() {
// gak
};
})();
@type MyModule
is mandatory and should be the same as your real module name.@memberOf MyModule
and /** @constructor */
at closure function is used to display inner functions and variables inside module closure (i.e. innerFunc()
). If you use the same 'type' here as in the @type
definition the public functions will be listed in the same outline in Eclipse. Alternatively we can use some other name (here __MyModule
and get a separate 'outline tree' for the public methods.@memberOf
module binds the API's methods to your module/type and will make them appear in the outline as well as the auto-complete context-menu (after typing MyModule.|
for example).(Original Idea from http://www.eclipse.org/forums/index.php/m/665434/)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With