no JavaScript auto complete in PyDev Eclipse project

懵懂的女人 提交于 2019-12-21 20:31:19

问题


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!


回答1:


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.




回答2:


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'.




回答3:


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.



来源:https://stackoverflow.com/questions/10863264/no-javascript-auto-complete-in-pydev-eclipse-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!