Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No code completion and syntax highlighting in Pydev

Tags:

python

ide

I just configured Eclipse with PyDev latest version, but when I import external modules, neither code completion nor syntax highlighting works. How do I enable it?

Komodo Edit does a better synax highlighting, apparently. - But Ctrl+R doesnt run the program.

I prefer a SciTE kind of editor with similar highlighting and fonts (aesthetics) and F5 working but with display of folder and files dynamically like Komodo Edit and a better code completion and vi emulation. Suggestions, please.

If I want to buy a Py IDE, Komodo or Wingware, which is better?-- Wrt syntax highlighting and code completion

like image 793
lprsd Avatar asked Jan 29 '09 09:01

lprsd


2 Answers

To enable code completion, go to Window > Preferences > Pydev > Editor > Code Completion, and check the 'Use Code Completion?' box, as well as the other boxes for what you want to complete on. It seems to take a second to load, the first time it has to complete something.

Syntax coloring should just work by default. Right-click on the file in the package explorer, go to 'Open With', and make sure you're opening it with the Python Editor, and not the regular Text Editor.

I don't know exactly what you mean by importing external modules. I have my source in a separate directory structure on disk; my PyDev projects contain folders linked to those. Code completion works for that, as well as other modules like 'os'. If you're having troubles, are the modules added to the PyDev's Python search path (not necessarily the same as the regular one)?

I took a brief look at Komodo and Wingware a while back, so I can't answer the second part of your question. But ended up going with PyDev. I'm not a big fan of Eclipse, but PyDev works reasonably well for me.

like image 133
DNS Avatar answered Oct 13 '22 21:10

DNS


The typical reason that code completion doesn't work under PyDev is that the libraries aren't in the PYTHONPATH. If you go into the Project Properties, and setup PyDev PYTHONPATH preferences to include the places where the code you are trying to complete lives, it will work just fine...

Project > Properties > PyDev-PYTHONPAH > click 'Add source folder'

like image 32
Tim White Avatar answered Oct 13 '22 22:10

Tim White