forked from VimPlug/jedi
fix Definition.name API for params
This commit is contained in:
@@ -138,7 +138,10 @@ class Script(object):
|
|||||||
for call_def in self.call_signatures():
|
for call_def in self.call_signatures():
|
||||||
if not isinstance(call_def.module, compiled.CompiledObject):
|
if not isinstance(call_def.module, compiled.CompiledObject):
|
||||||
for p in call_def.params:
|
for p in call_def.params:
|
||||||
completions.append((p.get_name(), p))
|
# Allow access on _definition here, because it's a
|
||||||
|
# public API and we don't want to make the internal
|
||||||
|
# Name object public.
|
||||||
|
completions.append((p._definition.get_name(), p))
|
||||||
|
|
||||||
if not path and not isinstance(user_stmt, pr.Import):
|
if not path and not isinstance(user_stmt, pr.Import):
|
||||||
# add keywords
|
# add keywords
|
||||||
|
|||||||
@@ -451,11 +451,12 @@ class Definition(BaseDefinition):
|
|||||||
return None
|
return None
|
||||||
elif isinstance(d, pr.Statement):
|
elif isinstance(d, pr.Statement):
|
||||||
try:
|
try:
|
||||||
name = d.assignment_details[0][1].values[0][0].name.names[-1]
|
expression_list = d.assignment_details[0][0]
|
||||||
|
name = expression_list[0].name.names[-1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if isinstance(d, pr.Param):
|
if isinstance(d, pr.Param):
|
||||||
try:
|
try:
|
||||||
name = d.expression_list()[0].name.names[-1]
|
return unicode(d.expression_list()[0].name)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -8,11 +8,9 @@ import os
|
|||||||
|
|
||||||
from jedi._compatibility import builtins as _builtins
|
from jedi._compatibility import builtins as _builtins
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi.parser.representation import Base, IsScope
|
|
||||||
from jedi.cache import underscore_memoization
|
from jedi.cache import underscore_memoization
|
||||||
from jedi.evaluate.sys_path import get_sys_path
|
from jedi.evaluate.sys_path import get_sys_path
|
||||||
from jedi.parser.representation import Param
|
from jedi.parser.representation import Param, SubModule, Base, IsScope, Operator
|
||||||
from jedi.parser.representation import SubModule
|
|
||||||
from jedi.evaluate.helpers import FakeName
|
from jedi.evaluate.helpers import FakeName
|
||||||
from . import fake
|
from . import fake
|
||||||
|
|
||||||
@@ -38,7 +36,10 @@ class CompiledObject(Base):
|
|||||||
# object
|
# object
|
||||||
start_pos, end_pos = (0, 0), (0, 0)
|
start_pos, end_pos = (0, 0), (0, 0)
|
||||||
for p in tokens:
|
for p in tokens:
|
||||||
params.append(Param(module, [FakeName(p.strip())], start_pos,
|
parts = [FakeName(part) for part in p.strip().split('=')]
|
||||||
|
if len(parts) >= 2:
|
||||||
|
parts.insert(1, Operator('=', (0, 0)))
|
||||||
|
params.append(Param(module, parts, start_pos,
|
||||||
end_pos, builtin))
|
end_pos, builtin))
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user