mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
More stable exception handling in the completer.
This commit is contained in:
parent
ff4b6c1bc6
commit
eb12f95976
2 changed files with 31 additions and 0 deletions
23
news/completer_exception.rst
Normal file
23
news/completer_exception.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* More stable exception handling in the tab completer.
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -2,6 +2,7 @@
|
|||
"""A (tab-)completer for xonsh."""
|
||||
import builtins
|
||||
import collections.abc as cabc
|
||||
from xonsh.tools import print_exception
|
||||
|
||||
|
||||
class Completer(object):
|
||||
|
@ -36,6 +37,13 @@ class Completer(object):
|
|||
out = func(prefix, line, begidx, endidx, ctx)
|
||||
except StopIteration:
|
||||
return set(), len(prefix)
|
||||
except Exception as e:
|
||||
print_exception(
|
||||
f"Completer {func.__name__} raises exception when get "
|
||||
f"(prefix={repr(prefix)}, line={repr(line)}, begidx={repr(begidx)}, endidx={repr(endidx)}):\n"
|
||||
f"{e}"
|
||||
)
|
||||
return set(), len(prefix)
|
||||
if isinstance(out, cabc.Sequence):
|
||||
res, lprefix = out
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue