1
0
forked from VimPlug/jedi

preload_module function for IDEs, to control which modules to load on startup, refs #102

This commit is contained in:
David Halter
2013-05-13 09:12:08 +04:30
parent b5b625ea14
commit 15885e8685
3 changed files with 35 additions and 6 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ import sys
# imports and circular imports... Just avoid it:
sys.path.insert(0, __path__[0])
from .api import Script, NotFoundError, set_debug_function, _quick_complete
from .api import Script, NotFoundError, set_debug_function, _quick_complete, \
preload_module
from . import settings
sys.path.pop(0)
+12
View File
@@ -522,6 +522,18 @@ def defined_names(source, source_path=None, source_encoding='utf-8'):
return api_classes._defined_names(parser.scope)
def preload_module(*modules):
"""
Preloading modules tells Jedi to load a module now, instead of lazy parsing
of modules. Usful for IDEs, to control which modules to load on startup.
:param modules: different module names, list of string.
"""
for m in modules:
s = "import %s as x; x." % m
Script(s, 1, len(s), None).complete()
def set_debug_function(func_cb=debug.print_to_stdout, warnings=True,
notices=True, speed=True):
"""