Fix stack trace parsing with "Unknown Source"

Closes #37.
This commit is contained in:
Tim Pope 2013-01-15 21:35:40 -05:00
parent 123bea5850
commit aed21575b8

View File

@ -374,17 +374,20 @@ endfunction
function! foreplay#quickfix_for(stacktrace) abort function! foreplay#quickfix_for(stacktrace) abort
let qflist = [] let qflist = []
for line in a:stacktrace for line in a:stacktrace
let match = matchlist(line, '\(.*\)(\(.*\):\(\d\+\))')
let entry = {'text': line} let entry = {'text': line}
let [_, class, file, lnum; __] = match let match = matchlist(line, '\(.*\)(\(.*\))')
let entry.lnum = lnum if !empty(match)
let truncated = substitute(class, '\.[A-Za-z0-9_]\+\%($.*\)$', '', '') let [_, class, file; __] = match
if file == 'NO_SOURCE_FILE' if file =~# '^NO_SOURCE_FILE:' || file !~# ':'
let entry.resource = '' let entry.resource = ''
let entry.lnum = 0
else else
let entry.resource = tr(truncated, '.', '/').'/'.file let truncated = substitute(class, '\.[A-Za-z0-9_]\+\%($.*\)$', '', '')
let entry.resource = tr(truncated, '.', '/').'/'.split(file, ':')[0]
let entry.lnum = split(file, ':')[-1]
endif endif
let qflist += [entry] let qflist += [entry]
endif
endfor endfor
let paths = map(copy(qflist), 'foreplay#findresource(v:val.resource)') let paths = map(copy(qflist), 'foreplay#findresource(v:val.resource)')
let i = 0 let i = 0