1
0
forked from VimPlug/jedi

moved more functions from api to helpers

This commit is contained in:
Dave Halter
2014-01-29 00:28:31 +01:00
parent 7aef1f934d
commit 36de8c427f
3 changed files with 56 additions and 45 deletions

View File

@@ -10,6 +10,8 @@ import os
import sys
from jedi import Interpreter
from jedi.api.helpers import completion_parts
from jedi.parser.user_context import UserContext
def setup_readline(namespace_module=__main__):
@@ -53,7 +55,7 @@ def setup_readline(namespace_module=__main__):
bash).
"""
class JediRL():
class JediRL(object):
def complete(self, text, state):
"""
This complete stuff is pretty weird, a generator would make
@@ -70,7 +72,8 @@ def setup_readline(namespace_module=__main__):
try:
interpreter = Interpreter(text, [namespace_module.__dict__])
path, dot, like = interpreter._get_completion_parts()
path = UserContext(text, (1, len(text))).get_path_until_cursor()
path, dot, like = completion_parts(path)
before = text[:len(text) - len(like)]
completions = interpreter.completions()
finally: