How to indicate public/protected/private members in JSDT outline view?
-
03-07-2019 - |
Question
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...
Solution
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 :)
OTHER TIPS
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.
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.