Skip to content

Commit

Permalink
xonsh: fix empty result (#2422)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube authored Jul 17, 2024
1 parent b10c6bc commit 9ca6b5f
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cmd/carapace/cmd/lazyinit/xonsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,14 @@ def _carapace_completer(context):
output, _ = sub_proc_get_output(
'carapace', context.command, 'xonsh', *[a.value for a in context.args], fix_prefix(context.prefix)
)
if not output:
return
for c in loads(output):
yield RichCompletion(
c["Value"],
display=c["Display"],
description=c["Description"],
prefix_len=len(context.raw_prefix),
append_closing_quote=False,
style=c["Style"],
)
try:
result = {RichCompletion(c["Value"], display=c["Display"], description=c["Description"], prefix_len=len(context.raw_prefix), append_closing_quote=False, style=c["Style"]) for c in loads(output)}
except:
result = {}
if len(result) == 0:
result = {RichCompletion(context.prefix, display=context.prefix, description='', prefix_len=len(context.raw_prefix), append_closing_quote=False)}
return result
add_one_completer('carapace', _carapace_completer, 'start')
`
Expand Down

0 comments on commit 9ca6b5f

Please sign in to comment.