Code completion for custom modules not working with PyDev

自闭症网瘾萝莉.ら 提交于 2019-12-24 06:49:52

问题


Let's say I make a module called mylib.py. In eclipse I type

import mylib

Then I type mylib. and hit CTRL+SPACE. This should suggest functions/variables in mylib, but it doesn't do anything. If I do something like import os and type os., suggestions immediately pop up, so I know code completion works in general, just not for my modules. Any reason why?


回答1:


In order to get completion for custom modules, PyDev has to index it (if possible) and introspect the classes, functions, variables and imports defined there. To do so, you should add your module to the eclipse's PYTHONPATH and then reindex your venv (the one defined in PyDev).

Most of the times this is done automatically by the IDE but it doesn't work quite well (at least it is not perfect).

I really suggest you not to rely at 100% on the IDE completion.



来源:https://stackoverflow.com/questions/10261958/code-completion-for-custom-modules-not-working-with-pydev

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