Capture nREPL stack trace

This commit is contained in:
Tim Pope 2013-01-07 01:51:48 -05:00
parent 0ff9cd710d
commit 528cb5b01a

View File

@ -129,6 +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.*)$'
let combined.stacktrace = split(response.out, "\t")
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
@ -143,7 +145,8 @@ function! s:nrepl_process(payload) dict abort
endfunction endfunction
function! s:nrepl_eval(expr, ...) dict abort function! s:nrepl_eval(expr, ...) dict abort
let payload = {"op": "eval", "code": a:expr} let payload = {"op": "eval"}
let payload.code = '(try '.a:expr.' (catch Exception e (print (apply str (interpose "\t" (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