1

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!

phalanx
  • 43
  • 9

1 Answers1

1

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.

Angelo
  • 2,027
  • 13
  • 17
  • Thanks for your suggestion Angelo! I tried installing tern but it doesn't seem to be working. I installed 3 things: 1. Tern feature 2. Tern JSDT feature 3. Tern Linters Then i converted project to Tern and in Properties->tern->Modules , the completion guess is checked. But content assist shows no additional suggestions. If I press Ctrl+Space again, it says "No Tern Completion Proposal Category" – phalanx Jul 08 '15 at 14:35
  • You need to install "Tern - Embed Node.js" too if you have not node installed, because ternjs is executed by node. – Angelo Jul 08 '15 at 23:10
  • Now it is trying to fetch proposals from tern server and then errors out with a long message, part of which is "The extension took too long to return from the 'computeCompleteProposals()' operation. Does it need to contact a server for every proposal? Because that will be slow anyway – phalanx Jul 09 '15 at 09:19
  • The error message also said to remove plugin from word proposals list, after I did, it started working!!! – phalanx Jul 09 '15 at 09:21
  • ternjs can be slow if you load a lot of JS files (on the first time). If you install 1.0.0-SNAPSHOT you can exclude path https://github.com/angelozerr/tern.java/wiki/New-and-Noteworthy-1.0.0#includeexclude-tern-script-paths – Angelo Jul 09 '15 at 11:37