1

Javascript Developer Tools (JSDT) for Eclipse provides a nice outline view of Javascript classes, with a little symbol next to them to indicate visibility.

Looking at Preferences->Javascript->Appearance->Members Sort Order, it seems able to indicate whether a method is public, private or protected, but all of my use the "default" marker, a blue triangle.

Does anyone know how it determines which symbol to use? I've tried using Javadoc and JSDoc formatted comments. My private methods start with a leading underscore, and that doesn't give it a hint either.

Not a big deal, just would be nice to know...

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348

3 Answers3

1

Seems that it is just a standard Java-based settings tree (used in many plugins) but without real implementation of JS private members stuff. Oh, we can hope that it is reserved for future use :)

Sergey Galashyn
  • 6,946
  • 2
  • 19
  • 39
0

There's no syntactical way of making a method private, public or protected in JavaScript, it strictly relies on where the method is defined (scope).

Marking a methods privacy is something else, there really isn't a standard for that. All I've ever heard of is the "underscore" for private members. So maybe JSDT doesn't implement this.

Luca Matteis
  • 29,161
  • 19
  • 114
  • 169
0

I believe there is a @private annotation supported by JSDoc. Not sure how standard it is, or whether JSDT supports/enforces it.

Since JSDT is a reimplementation of the JDT interfaces, it may just be reusing JDT's private/protected/public model best it can, without an actual way to mark fields/methods for access control.

levik
  • 114,835
  • 27
  • 73
  • 90