How to enable inline JavaScript autocomplete in Eclipse IDE with the Aptana extension

autocompleteeclipsehtml-filesjavascript

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?

Best Answer

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.

Related Question