mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge branch 'completer_execution' of https://github.com/adqm/xonsh into adqm-completer_execution
This commit is contained in:
commit
36a6aa7afc
1 changed files with 14 additions and 3 deletions
|
@ -378,14 +378,25 @@ class Completer(object):
|
|||
expr = subexpr_from_unbalanced(expr, '(', ')')
|
||||
expr = subexpr_from_unbalanced(expr, '[', ']')
|
||||
expr = subexpr_from_unbalanced(expr, '{', '}')
|
||||
_ctx = None
|
||||
try:
|
||||
val = builtins.evalx(expr, glbs=ctx)
|
||||
val = eval(expr, ctx)
|
||||
_ctx = ctx
|
||||
except: # pylint:disable=bare-except
|
||||
try:
|
||||
val = builtins.evalx(expr, glbs=builtins.__dict__)
|
||||
val = eval(expr, builtins.__dict__)
|
||||
_ctx = builtins.__dict__
|
||||
except: # pylint:disable=bare-except
|
||||
return attrs # anything could have gone wrong!
|
||||
opts = dir(val)
|
||||
_opts = dir(val)
|
||||
# check whether these options actually work (e.g., disallow 7.imag)
|
||||
opts = []
|
||||
for i in _opts:
|
||||
try:
|
||||
v = eval('%s.%s' % (expr,i), _ctx)
|
||||
opts.append(i)
|
||||
except:
|
||||
continue
|
||||
if len(attr) == 0:
|
||||
opts = [o for o in opts if not o.startswith('_')]
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue