Merge pull request #609 from gforsyth/multiline_fix

help `compile` not lose its mind
This commit is contained in:
Anthony Scopatz 2016-01-07 15:38:57 -08:00
commit bd964ce552

View file

@ -21,6 +21,8 @@ class TabShouldInsertIndentFilter(Filter):
def can_compile(src): def can_compile(src):
"""Returns whether the code can be compiled, i.e. it is valid xonsh.""" """Returns whether the code can be compiled, i.e. it is valid xonsh."""
if not src.endswith('\n') and not src.endswith('\''):
src = src + '\n'
try: try:
builtins.__xonsh_execer__.compile(src, mode='single', glbs=None, builtins.__xonsh_execer__.compile(src, mode='single', glbs=None,
locs=builtins.__xonsh_ctx__) locs=builtins.__xonsh_ctx__)