1
0
forked from VimPlug/jedi

Finally able to remove the user_context. This is awesome!

Now we only use the syntax tree to understand where the user is doing something.
This commit is contained in:
Dave Halter
2016-06-23 16:26:28 +02:00
parent 672bf9908c
commit 73e71b3c1a
6 changed files with 21 additions and 321 deletions

View File

@@ -10,8 +10,8 @@ import os
import sys
from jedi import Interpreter
from jedi.api.helpers import get_completion_parts
from jedi.parser.user_context import UserContext
from jedi.api.helpers import get_on_completion_name
from jedi import common
def setup_readline(namespace_module=__main__):
@@ -72,9 +72,10 @@ def setup_readline(namespace_module=__main__):
try:
interpreter = Interpreter(text, [namespace_module.__dict__])
path = UserContext(text, (1, len(text))).get_path_until_cursor()
path, dot, like = get_completion_parts(path)
before = text[:len(text) - len(like)]
lines = common.splitlines(text)
position = (len(lines), len(lines[-1]))
name = get_on_completion_name(lines, position)
before = text[:len(text) - len(name)]
completions = interpreter.completions()
finally:
sys.path.pop(0)