make eclipse work better with javascript - Stack Overflow

I'm working in a javaeclipse shop writing javascript, ing from a phpnetbeans background. So far,

I'm working in a java/eclipse shop writing javascript, ing 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-pletion 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?

I'm working in a java/eclipse shop writing javascript, ing 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-pletion 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?

Share Improve this question asked Oct 21, 2010 at 17:09 sprugmansprugman 19.8k36 gold badges115 silver badges164 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

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 autoplete! 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-plete context-menu (after typing MyModule.| for example).

(Original Idea from http://www.eclipse/forums/index.php/m/665434/)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744800000a4594434.html

相关推荐

  • make eclipse work better with javascript - Stack Overflow

    I'm working in a javaeclipse shop writing javascript, ing from a phpnetbeans background. So far,

    2天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信