mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
add set of completion wrap tokens for bash escape
I've noticed a few more problems in the way that the xonsh parser can interfere with bash completion (or vice versa). This adds a set of tokens that might show up in filenames that cause trouble. If one of these tokens is in a filename/path then the bash completer will return the `repr` of the filename and the xonsh parser won't try to interpret the special symbols in the filename
This commit is contained in:
parent
4651e66154
commit
f5b86b6a0f
1 changed files with 3 additions and 1 deletions
|
@ -30,6 +30,8 @@ XONSH_TOKENS = {
|
|||
|
||||
COMPLETION_SKIP_TOKENS = {'sudo', 'time'}
|
||||
|
||||
COMPLETION_WRAP_TOKENS = {' ',',','[',']','(',')','{','}'}
|
||||
|
||||
BASH_COMPLETE_SCRIPT = """source {filename}
|
||||
COMP_WORDS=({line})
|
||||
COMP_LINE={comp_line}
|
||||
|
@ -318,7 +320,7 @@ class Completer(object):
|
|||
space = ' '
|
||||
slash = '/'
|
||||
rtn = {_normpath(repr(s + (slash if os.path.isdir(s) else '')))
|
||||
if space in s else
|
||||
if (COMPLETION_WRAP_TOKENS.intersection(s) != set()) else
|
||||
s + space
|
||||
if s[-1:].isalnum() else
|
||||
s for s in out.splitlines()}
|
||||
|
|
Loading…
Add table
Reference in a new issue