I am using Eclipse Juno developing a static web project. My project uses several different JavaScript files. One of the files contains a function:
function IconData(size, url) {
this.size = size;
this.url = url;
}
I have another function that returns an object of type IconData:
function PageInfo() {
this.iconData = function() {
var iconData = new IconData();
iconData.size = 10;
iconData.url = "http://somepage.com/image.png";
return iconData;
}
}
In another JavaScript file I create an instance of PageInfo and call the function iconData:
var page = new PageInfo();
// populate stuff
var icon = page.iconData();
If I type icon. then CTRL+SPACE to start code assist I get the following message popups in Eclipse:
No Default Proposals
No Template Proposals
However, if I create a new instance of icon data such as:
var iconData = new IconData();
then I type iconData. then CTRL-SPACE the code assist pops up and show me all the possibilities:
Why doesn't code assist work in the first scenario but it works in the second?
P.S. I have Googled how to enable code assist for JavaScript in Eclipse I found several sites that said I need to make sure I have JavaScript Development Tools installed and I made sure that I have them installed so I know that is not the issue.
I think it's a limitation with JSDT. I suggest you that you install tern.java which extends JSDT to improve JS completion, hyperlink, hover.
Copy your JS files in a folder, convert your project as tern and configure Script path with your folder. Please read Getting Started to know how to do that.
Here a screenshot with your case (here scripts folder is configured as script path):
Please note that tern.java is developed with Eclipse Luna, so I suggest you to use this version and not Juno.