Using Eclipse Oxygen running on OSX. I have several files with object structures mimicing classes using prototype in the standard way:
function MyClass(args) {
this.testconstant = 'ctrl';
MyClass.prototype.start = function () {//initialises BaseCtrl - child objects must also call their own boot
}
}
however Eclipse simply shows the outline as:
o MyClass(args)
Is there a plugin or something that addresses this - it appears to be a long running issue that is still not fixed. I've set up as a new Javascript project.
In my opinion, an IDE really can't accurately tell you what objects in a "class" look like in JavaScript because there's really no such thing as a "class". Objects are dynamically constructed by code, and it's code that can do absolutely anything. It can, for example, randomly create an object with randomly-named properties on each invocation. That sounds contrived, but such things may prove useful to somebody because the flexibility is there.
A less contrived example would be a constructor that accepts some number of parameters, and the values of those parameters determine what properties are initialized on the constructed object.
Thus, to really get it right, an IDE would have to execute the constructor code, and it would have to know what parameters to pass, and it would somehow have to deal with the fact that a single constructor can construct an infinite variety of differently "shaped" objects. Thus, in practical terms, the best it could do would be to show you what's on the prototype object.
Now, in ES2015 there's a class
declaration syntax that brings a little order to the chaos, and an IDE could easily leverage that to enhance the editing experience. Not a whole lot different than just figuring out what the prototype looks like, but probably somewhat easier since the issue of where the prototype comes from is pretty open-ended too.
Note that I have no idea how in particular Eclipse or any other IDE deals with this.