Question

I have Eclipse with PyDev and JavaScript Development Tools (JSDT). I'm using this environment to develop web applications.

Python, HTML, and CSS editors all work fine: highlighting and auto completion works. JavaScript highlighting works too, but JavaScript auto completion does not work.

Switching to the JavaScript perspective doesn't help.

However, if I create a separate JavaScript Project (rather than adding JavaScript files into my PyDev project), JavaScript auto completion seems to work properly.

Additional Details

When I create a JavaScript Project, Eclipse adds certain JavaScript Resources to the project by default. For example, ECMAScript Built-In Library and ECMA 3 Browser Support Library. These are visible in the Script Explorer window, as well as under Project Properties -> JavaScript -> Libraries.

The problem is, I don't have a Project Properties -> JavaScript option when in a PyDev Project.

Question: What do I need to do (e.g. config wise) to get JavaScript auto completion in Eclipse, when NOT in a JavaScript Project (i.e. when in a PyDev Project)? Is it possible to add a JavaScript perspective/(I'm not sure what call this exactly...) to a PyDev Project in Eclipse?

I'm very new (2 days) to JavaScript development, so preemptive apologies if the problem/solution is trivial!

Was it helpful?

Solution

You should create a javascript project first and then make it a PyDev project (right click it > PyDev > Set as PyDev project).

Also, if you're starting out, you may want to check Aptana Studio 3: http://aptana.org/ (it's set of Eclipse plugins that has the whole toolchain for web development, with editors for javascript, html, css as well as PyDev preinstalled) -- note that you can check it by just downloading the standalone version and pointing to an existing workspace.

OTHER TIPS

To add JavaScript to an existing project convert it to a 'Faceted Project' type and then add the JavaScript facet; to do so go 'Project' > 'Properties'.

enter image description here

To add JavaScript to an existing PyDev project (Daniel Sokolowski's answer doesn't work for PyDev in Eclipse Neon. Facets are only available for J2EE projects -- See eclipse's documentation on project facets):

  1. Close out eclipse.
  2. Browse to your project folder and open the .project file with a text editor.
  3. Add the following to the <natures> tag next to the pydev natures: <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
  4. Save and reopen your project.

I could then go into Project > Properties > JavaScript > Include Path and add libraries to use for auto-completion. Both auto-completion and the JavaScript Editor save actions worked from the PyDev perspective.

This was in Eclipse Neon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top