Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view the outline in eclipse when using the revealing module pattern?

I'm currently refactoring some Javascript code we have and amongst other things I've changed it to make use of the revealing module pattern. The code is looking much tidier and it works fine but I can't see the functions anymore in the outline view. I see the top level namespace var as a var but you can't expand it to see the functions within.

Lets say the code used to look like this:

function myFunc1() {}
function myFunc2() {}

In this case you see both functions in the outline view. But if you change it to this:

var myNamespace = function()
{
  function myFunc1() {}
  function myFunc2() {}

  return {
    name: "myNamespace",
    myFunc1: myFunc1,
    myFunc2: myFunc2
  }
}();

Then the outline view just shows you the myNamespace var. I've tried looking but can't find a view that will actually show me the hierarchy correctly. Does anyone know of a way to view this or is it a case of eclipse not being able to do this?

like image 868
Ben Thurley Avatar asked Apr 18 '12 11:04

Ben Thurley


1 Answers

Add:

/**
 * @memberOf myNamespace
 */

before each function definition to restore the hierarchy.

You will find more interesting tags to document your code here:
How I Introduced JsDoc into a JavaScript project – and found my Eclipse Outline

like image 100
Francois Avatar answered Oct 03 '22 18:10

Francois