forked from VimPlug/jedi
REPL completion is working again partially. There's some progress at least.
This commit is contained in:
@@ -115,6 +115,7 @@ class CompiledObject(Base):
|
||||
elif inspect.isbuiltin(cls) or inspect.ismethod(cls) \
|
||||
or inspect.ismethoddescriptor(cls) or inspect.isfunction(cls):
|
||||
return 'function'
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
|
||||
@@ -7,8 +7,7 @@ import inspect
|
||||
from jedi import common
|
||||
from jedi.parser.fast import FastParser
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.cache import underscore_memoization, memoize_method
|
||||
from jedi.evaluate.cache import memoize_default
|
||||
from jedi.cache import underscore_memoization
|
||||
|
||||
|
||||
class MixedObject(object):
|
||||
@@ -38,6 +37,15 @@ class MixedObject(object):
|
||||
assert search_global is False
|
||||
return [LazyMixedNamesDict(self._evaluator, self, is_instance=False)]
|
||||
|
||||
def api_type(self):
|
||||
mappings = {
|
||||
'expr_stmt': 'statement',
|
||||
'classdef': 'class',
|
||||
'funcdef': 'function',
|
||||
'file_input': 'module',
|
||||
}
|
||||
return mappings[self._definition.type]
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (type(self).__name__, repr(self.obj))
|
||||
|
||||
|
||||
@@ -559,6 +559,8 @@ def global_names_dict_generator(evaluator, scope, position):
|
||||
|
||||
for names_dict in scope.names_dicts(True):
|
||||
yield names_dict, position
|
||||
if hasattr(scope, 'resets_positions'):
|
||||
position = None
|
||||
if scope.type == 'funcdef':
|
||||
# The position should be reset if the current scope is a function.
|
||||
in_func = True
|
||||
|
||||
Reference in New Issue
Block a user