mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Merge pull request #1495 from xonsh/alias_completion
re-enable tab completion for aliases
This commit is contained in:
commit
caddc5d927
4 changed files with 16 additions and 0 deletions
13
news/aliascomp.rst
Normal file
13
news/aliascomp.rst
Normal file
|
@ -0,0 +1,13 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Alias tab completion works again
|
||||
|
||||
**Security:** None
|
|
@ -102,6 +102,7 @@ class XonshKernel(Kernel):
|
|||
"""Get completions."""
|
||||
shell = builtins.__xonsh_shell__
|
||||
line = code.split('\n')[-1]
|
||||
line = builtins.aliases.expand_alias(line)
|
||||
prefix = line.split(' ')[-1]
|
||||
endidx = pos
|
||||
begidx = pos - len(prefix)
|
||||
|
|
|
@ -30,6 +30,7 @@ class PromptToolkitCompleter(Completer):
|
|||
endidx = document.cursor_position_col
|
||||
begidx = line[:endidx].rfind(' ') + 1 if line[:endidx].rfind(' ') >= 0 else 0
|
||||
prefix = line[begidx:endidx]
|
||||
line = builtins.aliases.expand_alias(line)
|
||||
completions, l = self.completer.complete(prefix,
|
||||
line,
|
||||
begidx,
|
||||
|
|
|
@ -255,6 +255,7 @@ class ReadlineShell(BaseShell, cmd.Cmd):
|
|||
rl_completion_suppress_append() # this needs to be called each time
|
||||
_rebind_case_sensitive_completions()
|
||||
|
||||
line = builtins.aliases.expand_alias(line)
|
||||
mline = line.partition(' ')[2]
|
||||
offs = len(mline) - len(text)
|
||||
if self.completer is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue