Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions autoload/exception.vim
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function! exception#trace() abort
continue
endif

let src = fnamemodify(matchstr(verb[1], 'Last set from \zs.\+'), ':p')
let src = fnamemodify(matchstr(verb[1], 'Last set from \zs.\+\ze\%( line \d\+\)'), ':p')
if !filereadable(src)
continue
endif
Expand All @@ -68,19 +68,31 @@ function! exception#trace() abort
endif
let pat .= func.'\>'

for line in readfile(src)
let lnum += 1
let function_offset = 0
let function_found = 0
let line_body = ''

for [index, line] in items(readfile(src))
if !function_found
let function_offset += 1
endif

if line =~# pat
let function_found = 1
endif

if lnum + function_offset == index + 1
let line_body = trim(line)
break
endif
endfor

if !empty(src) && !empty(func)
let fname = fnamemodify(src, ':.')
call add(errlist, {
\ 'text': printf('%*s. %s', nw, '#'.i, t),
\ 'text': printf('%*s. %s: %s', nw, '#'.i, t, line_body),
\ 'filename': fname,
\ 'lnum': lnum,
\ 'lnum': function_offset + lnum,
\ 'type': 'I',
\ })
endif
Expand Down