views:

360

answers:

3

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...

+1  A: 

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 :)

Sergii
A: 

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
A: 

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
Thanks, but I did mention I'd tried JSDoc tags without success :(
Paul Dixon