Skip to content

Commit 1d0969e

Browse files
committed
Fixing the quickfix window output. Better errorformat
1 parent 6e2f135 commit 1d0969e

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

autoload/pymode/run.vim

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,23 @@ except SystemExit as e:
3131
ENDPYTHON
3232
py out, err = sys.stdout.getvalue().strip(), sys.stderr.getvalue()
3333
py sys.stdout, sys.stderr = stdout_, stderr_
34-
3534
cexpr ""
36-
py for x in err.strip().split('\n'): vim.command('caddexpr "' + x.replace('"', r'\"') + '"')
35+
let l:traceback = []
3736
let l:oldefm = &efm
38-
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
37+
let &efm = '%E File "%f"\, line %l\,%m,'
38+
let &efm .= '%E File "%f"\, line %l,'
39+
let &efm .= '%C%p^,'
40+
let &efm .= '%+C %.%#,'
41+
let &efm .= '%+C %.%#,'
42+
let &efm .= '%Z%m,'
43+
let &efm .= '%-G%.%#'
44+
45+
python << ENDPYTHON2
46+
for x in [i for i in err.splitlines() if "<string>" not in i]:
47+
vim.command("call add(l:traceback, '{}')".format(x))
48+
ENDPYTHON2
49+
50+
cgetexpr(l:traceback)
3951
call pymode#QuickfixOpen(0, g:pymode_lint_hold, g:pymode_lint_maxheight, g:pymode_lint_minheight, 0)
4052
let &efm = l:oldefm
4153

@@ -49,8 +61,8 @@ else:
4961
EOF
5062

5163
catch /.*/
52-
64+
5365
echohl Error | echo "Run-time error." | echohl none
54-
66+
5567
endtry
5668
endfunction "}}}

0 commit comments

Comments
 (0)