Catch one line stack traces

References #38.
This commit is contained in:
Tim Pope 2013-01-15 20:45:44 -05:00
parent 6f93e99ede
commit fd8d623b7b

View File

@ -129,8 +129,8 @@ function! s:nrepl_process(payload) dict abort
if index(combined[key], response[key]) < 0 if index(combined[key], response[key]) < 0
call extend(combined[key], [response[key]]) call extend(combined[key], [response[key]])
endif endif
elseif key ==# 'out' && response.out =~# '^.*(.*:\d\+)\t.*)$' elseif key ==# 'out' && response.out =~# '^\b.*(.*)$'
let combined.stacktrace = split(response.out, "\t") let combined.stacktrace = split(response.out, "\b")
elseif type(response[key]) == type('') elseif type(response[key]) == type('')
let combined[key] = get(combined, key, '') . response[key] let combined[key] = get(combined, key, '') . response[key]
else else
@ -146,7 +146,7 @@ endfunction
function! s:nrepl_eval(expr, ...) dict abort function! s:nrepl_eval(expr, ...) dict abort
let payload = {"op": "eval"} let payload = {"op": "eval"}
let payload.code = '(try (eval ''(do '.a:expr."\n".')) (catch Exception e (print (apply str (interpose "\t" (map str (.getStackTrace e))))) (throw e)))' let payload.code = '(try (eval ''(do '.a:expr."\n".')) (catch Exception e (print (apply str (interleave (repeat "\b") (map str (.getStackTrace e))))) (throw e)))'
let options = a:0 ? a:1 : {} let options = a:0 ? a:1 : {}
if has_key(options, 'ns') if has_key(options, 'ns')
let payload.ns = options.ns let payload.ns = options.ns