forked from VimPlug/jedi
Completion now always takes a NamePart as input.
This commit is contained in:
@@ -179,7 +179,9 @@ class Script(object):
|
||||
comps = []
|
||||
comp_dct = {}
|
||||
for c, s in set(completions):
|
||||
n = str(c.names[-1])
|
||||
# TODO Remove this line. c should be a namepart even before that.
|
||||
c = c.names[-1]
|
||||
n = str(c)
|
||||
if settings.case_insensitive_completion \
|
||||
and n.lower().startswith(like.lower()) \
|
||||
or n.startswith(like):
|
||||
|
||||
@@ -430,7 +430,7 @@ class Completion(BaseDefinition):
|
||||
if isinstance(self._base, pr.Param):
|
||||
append += '='
|
||||
|
||||
name = str(self._name.names[-1])
|
||||
name = str(self._name)
|
||||
if like_name:
|
||||
name = name[self._like_name_length:]
|
||||
return dot + name + append
|
||||
@@ -457,7 +457,7 @@ class Completion(BaseDefinition):
|
||||
|
||||
would return `isinstance`.
|
||||
"""
|
||||
return unicode(self._name.names[-1])
|
||||
return unicode(self._name)
|
||||
|
||||
@property
|
||||
def name_with_symbols(self):
|
||||
@@ -575,8 +575,6 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
||||
"""
|
||||
def __init__(self, evaluator, definition):
|
||||
super(Definition, self).__init__(evaluator, definition, definition.start_pos)
|
||||
if not isinstance(definition, pr.NamePart):
|
||||
raise NotImplementedError(definition)
|
||||
|
||||
@property
|
||||
@underscore_memoization
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import pydoc
|
||||
import keyword
|
||||
|
||||
from jedi.parser.representation import NamePart
|
||||
from jedi._compatibility import is_py3
|
||||
from jedi import common
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate.helpers import FakeSubModule
|
||||
|
||||
try:
|
||||
from pydoc_data import topics as pydoc_topics
|
||||
@@ -40,7 +42,7 @@ def get_operator(string, pos):
|
||||
class KeywordName(object):
|
||||
def __init__(self, parent, name, start_pos):
|
||||
self.parent = parent
|
||||
self.names = [name]
|
||||
self.names = [NamePart(FakeSubModule, name, self, (0, 0))]
|
||||
self.start_pos = start_pos
|
||||
|
||||
def get_definition(self):
|
||||
|
||||
Reference in New Issue
Block a user