Search code examples
pythonvimomnicomplete

Vim Python omni-completion failing to work on system modules


I'm noticing that even for system modules, code completion doesn't work too well.

For example, if I have a simple file that does:

import re
p = re.compile(pattern)
m = p.search(line)

If I type p., I don't get completion for methods I'd expect to see (I don't see search() for example, but I do see others, such as func_closure(), func_code()).

If I type m., I don't get any completion what so ever (I'd expect .groups(), in this case).

This doesn't seem to affect all modules.. Has any one seen this behaviour and knows how to correct it?

I'm running Vim 7.2 on WinXP, with the latest pythoncomplete.vim from vim.org (0.9), running python 2.6.2.


Solution

  • Completion for this kind of things is tricky, because it would need to execute the actual code to work.

    For example p.search() could return None or a MatchObject, depending on the data that is passed to it.

    This is why omni-completion does not work here, and probably never will. It works for things that can be statically determined, for example a module's contents.