From aed21575b8da2715e03917e40035129ad8bf286f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 15 Jan 2013 21:35:40 -0500 Subject: [PATCH] Fix stack trace parsing with "Unknown Source" Closes #37. --- plugin/foreplay.vim | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index d48a1e5..3b7714c 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -374,17 +374,20 @@ endfunction function! foreplay#quickfix_for(stacktrace) abort let qflist = [] for line in a:stacktrace - let match = matchlist(line, '\(.*\)(\(.*\):\(\d\+\))') let entry = {'text': line} - let [_, class, file, lnum; __] = match - let entry.lnum = lnum - let truncated = substitute(class, '\.[A-Za-z0-9_]\+\%($.*\)$', '', '') - if file == 'NO_SOURCE_FILE' - let entry.resource = '' - else - let entry.resource = tr(truncated, '.', '/').'/'.file + let match = matchlist(line, '\(.*\)(\(.*\))') + if !empty(match) + let [_, class, file; __] = match + if file =~# '^NO_SOURCE_FILE:' || file !~# ':' + let entry.resource = '' + let entry.lnum = 0 + else + let truncated = substitute(class, '\.[A-Za-z0-9_]\+\%($.*\)$', '', '') + let entry.resource = tr(truncated, '.', '/').'/'.split(file, ':')[0] + let entry.lnum = split(file, ':')[-1] + endif + let qflist += [entry] endif - let qflist += [entry] endfor let paths = map(copy(qflist), 'foreplay#findresource(v:val.resource)') let i = 0