Skip to content

Commit

Permalink
xonsh: fix empty result
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jul 8, 2024
1 parent 74167cb commit 11fce07
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions internal/shell/xonsh/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ def _%v_completer(context):
output, _ = sub_proc_get_output(
'%v', '_carapace', '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('%v', _%v_completer, 'start')
`, functionName, cmd.Name(), cmd.Name(), uid.Executable(), cmd.Name(), functionName)
Expand Down

0 comments on commit 11fce07

Please sign in to comment.