Tab Completer (xonsh.completer)

A (tab-)completer for xonsh.

class xonsh.completer.Completer[source]

This provides a list of optional completions for the xonsh shell.

complete(prefix, line, begidx, endidx, ctx=None, multiline_text=None, cursor_index=None)[source]

Complete the string, given a possible execution context.

Parameters
prefixstr

The string to match

linestr

The line that prefix appears on.

begidxint

The index in line that prefix starts on.

endidxint

The index in line that prefix ends on.

ctxdict, optional

Names in the current execution context.

multiline_textstr

The complete multiline text. Needed to get completion context.

cursor_indexint

The current cursor’s index in the multiline text. May be len(multiline_text) for cursor at the end. Needed to get completion context.

Returns
rtnlist of str

Possible completions of prefix, sorted alphabetically.

lprefixint

Length of the prefix to be replaced in the completion.

complete_from_context(completion_context, old_completer_args=None)[source]
static generate_completions(completion_context, old_completer_args, trace: bool)Iterator[Tuple[Union[xonsh.completers.tools.RichCompletion, str], int]][source]