mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
jedi: refactor completions
This fixes jedi completions backtrace in the scenario where CASE_SENSITIVE_COMPLETIONS is set.
This commit is contained in:
parent
67b97b9571
commit
22a078377d
1 changed files with 9 additions and 6 deletions
|
@ -30,14 +30,17 @@ def complete_jedi(prefix, line, start, end, ctx):
|
|||
return set()
|
||||
src = builtins.__xonsh__.shell.shell.accumulated_inputs + line
|
||||
script = jedi.api.Interpreter(src, [ctx], column=end)
|
||||
script_comp = set()
|
||||
try:
|
||||
script_comp = script.completions()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if builtins.__xonsh__.env.get('CASE_SENSITIVE_COMPLETIONS'):
|
||||
rtn = {x.name_with_symbols for x in script.completions()
|
||||
if x.name_with_symbols.startswith(prefix)}
|
||||
rtn = {x.name_with_symbols for x in script_comp
|
||||
if x.name_with_symbols.startswith(prefix)}
|
||||
else:
|
||||
try:
|
||||
rtn = {x.name_with_symbols for x in script.completions()}
|
||||
except Exception:
|
||||
rtn = set()
|
||||
rtn = {x.name_with_symbols for x in script_comp}
|
||||
return rtn
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue