18

Background

  • I have Eclipse IDE.
  • I have installed the Aptana studio plugin for Eclipse.
  • I am editing an HTML file.
  • JavaScript auto-complete / content assist only works half of the time:
  • Eclipse won’t content assist my functions and variables between <script> tags.
  • But it will work for core JavaScript items.
  • I have searched the Eclipse help menu in the Eclipse program but that keeps getting indexing errors when I submit a search query.
  • I have checked the Eclipse site.
  • I have searched google.

If Eclipse content assist works for user-created ids and classes in HTML and CSS, surely it can work for user-created JavaScript variables and functions, right?

Unhelpful Findings

  1. I seem to have found a guide on how to enable javascript content assist for PHP files. But the problem is that I’m not using PHP. I’m using HTML so I can’t select the PHP Explorer View as this guide instructs.

  2. This guy seems to have the same problem - maybe. But he might just be typing in syntax errors with his javascript according to his example code (the capital D in getElementById...).

  3. Here’s one more. Under the heading JavaScript Content Assist Configuration, this guide says to go to Window | Preferences | Web | JavaScript | Editor | Content Assist. Problem is Window | Preferences | Web doesn’t even exist in my version of Eclipse

Problem

Does anybody know how to enable Eclipse’s JavaScript content assist in an html file between script tags for the functions and variables that I have created in the html file?

  • 2
    Same with me, don't know who can help us with this. – andyPaul Jun 22 '14 at 23:36
  • @andyPaul we're doomed. – Rhyknowscerious Jun 24 '14 at 11:39
  • I have the exact opposite problem (and funnily enough I run netbeans), I only get auto-complete suggestions on my code, and basic constructs. document.get<pause> Returns nothing... Anybody have a little bit more reputation and want to start a bounty? – Damian Nikodem Feb 26 '15 at 14:54
  • Just a tidbit of info, Aptana was recently acquired by Appcelerator to most likely merge with their Titanium product. techcrunch.com/2011/01/18/… Just thought this might be relevant if it is a bug, as Aptana might be discontinued and there for no longer support bug fixes. – user38331 Apr 23 '15 at 20:25
  • 1
    what about sublime text? most times it gives me good support. – Sachith Muhandiram Jul 25 '15 at 16:44
4

See if you can go to Window > Preferences > Javascript > Editor > Content Assist and ensuring that, under Auto-Activation, Enable Auto Activation Is checked.

That should automatically bring up Content Assist in blocks in html files.

Tested on Vanilla Eclipse PHP development install.

If that is still not working, try pressing CTRL + SPACE in the script block and see if content assist pops up. That is what should appear when Auto Activation is checked.

| improve this answer | |
  • Solved it for me with Eclipse Mars.1 – udog Jun 16 '16 at 14:16
  • Solved it for me with Eclipse Photon – DavidHyogo Aug 11 '18 at 14:31
0

Researching this a bit and reading over your comments it seems that you are using Eclipse with the Aptana extension. If you absolutely do not need to use the Eclipse environment you could now download the Aptana Studio 3 which is based on Eclipse. It looks just like eclipse but is Aptana. Now instead of entering this and looking for Aptana plugins you are going to go into Aptana and look for eclipse plugins. I've installed this myself and have installed several plugins that handle all sorts of things such as javascript code completion, source code formatting etc. If you go to this site http://www.aptana.com/ you can download the software there. To get all of the plugins, you can do use this site to guide you through some terrific source code completion utilities as well as others. http://jebaird.com/2012/11/02/useful-plugins-for-aptana-studio-3.html

His site isn't right on the money. I had to dig a little for some of them. I'll list the items he has below

To install do the following Help > Install new software > and clicking on the add button Name the site and then put in the url you're given once your items come up, make sure all the check boxes are selected and hit finish.

Hunspell for Eclipse http://hunspell4eclipse.googlecode.com/svn/trunk/com.lorands.hunspell4eclipse.updatesite/

JsHint http://github.eclipsesource.com/jshint-eclipse/updates/

Emmet
http://emmet.io/eclipse/updates/

Here is a javascript code formatter profile that is as close to the jQuery core style guide. You may or may not find it useful. You can find it here: https://github.com/jebaird/aptana-formatter-profiles

To import this style guide, download it and go to Window > Preferences > Aptana Stuido > Formatter. Click the import button

One of the most helpful things that I have found it is to search for eclipse plugins not aptana studio plugins. Since aptana is built on top of eclipse most of the plugins will work.

| improve this answer | |
0

For recent Eclipse versions (like my Indigo SR2), two things need to be done to get code assist for jQuery in a GAE project.

Configure the project to be a JavaScript project by: Right click project -> Configure (right above Property) -> Convert to JavaScript Project

jQuery autocompletion said, install the JSDT jQuery pluggin and add jQuery to the project's JavaScript Resources

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.