mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
more highlighting fixes
This commit is contained in:
parent
4f3910fe32
commit
43534f9de7
1 changed files with 9 additions and 4 deletions
|
@ -45,7 +45,10 @@ def _command_is_valid(cmd):
|
|||
def _command_is_autocd(cmd):
|
||||
if not builtins.__xonsh_env__.get('AUTO_CD', False):
|
||||
return False
|
||||
cmd_abspath = os.path.abspath(os.path.expanduser(cmd))
|
||||
tyr:
|
||||
cmd_abspath = os.path.abspath(os.path.expanduser(cmd))
|
||||
except (FileNotFoundError, OSError):
|
||||
return False
|
||||
return os.path.isdir(cmd_abspath)
|
||||
|
||||
|
||||
|
@ -60,9 +63,11 @@ def subproc_cmd_callback(_, match):
|
|||
def subproc_arg_callback(_, match):
|
||||
"""Check if match contains valid path"""
|
||||
text = match.group()
|
||||
yield (match.start(),
|
||||
Name.Constant if os.path.exists(os.path.expanduser(text)) else Text,
|
||||
text)
|
||||
try:
|
||||
ispath = os.path.exists(os.path.expanduser(text))
|
||||
except (FileNotFoundError, OSError):
|
||||
ispath = False
|
||||
yield (match.start(), Name.Constant if ispath else Text, text)
|
||||
|
||||
|
||||
COMMAND_TOKEN_RE = r'[^=\s\[\]{}()$"\'`<&|;!]+(?=\s|$|\)|\]|\}|!)'
|
||||
|
|
Loading…
Add table
Reference in a new issue