javascripteclipseinheritancecontent-assistjsdt

eclipse javascript plugins to detect inheritance


My project implemets inheritance via following code pattern:

ScanTemplate1.prototype = Object.create(ScanTemplateBase.prototype);
ScanTemplate1.prototype.contructor = ScanTemplate1;

Here, ScanTemplate1 inherits from ScanTemplateBase class.

Now in any .js file, content assist only suggests member functions defined in ScanTemplate1.js file. It doesn't suggest member functions inherited from ScanTemplateBase.

I am using eclipse Luna with latest JSDT version. Is there a way to enable content assist to suggest inherited member functions?

Example: ScanTemplateBase class has a function

ScanTemplateBase.prototype.getInstruction = function(){
    return this.instruction;
};

ScanTemplate1 has a function

ScanTemplate1.prototype.getTextbox = function() {
return this.textbox;
};

Now, in a file main.js, I have statement

var packageScanBox = new ScanTemplate1( ..... constructor args ....);

On typing packageScanBox. and pressing Ctrl + space, it suggests getTextbox() but not getInstruction()

Thanks in advance!


Solution

  • Disclaimer, I'm the author of tern.java

    I suggest you that you install tern.java which supports Object.create. I have tested quickly :

    enter image description here

    As tern.java is based on ternjs, you can test your case with ternjs online demo.