Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tolerate corrupt tags files and ctags output (issue #13)

  • Loading branch information...
commit b5e0b6b98282629db3ad11357efbbd98b0e62210 1 parent d727ac0
@xolox authored
Showing with 14 additions and 4 deletions.
  1. +13 −3 autoload/xolox/easytags.vim
  2. +1 −1  plugin/easytags.vim
View
16 autoload/xolox/easytags.vim
@@ -389,23 +389,33 @@ function! xolox#easytags#read_tagsfile(tagsfile) " {{{2
" otherwise Vim might complain with "E432: Tags file not sorted".
let headers = []
let entries = []
+ let num_invalid = 0
for line in readfile(a:tagsfile)
if line =~# '^!_TAG_'
call add(headers, line)
else
- call add(entries, xolox#easytags#parse_entry(line))
+ let entry = xolox#easytags#parse_entry(line)
+ if !empty(entry)
+ call add(entries, entry)
+ else
+ let num_invalid += 1
+ endif
endif
endfor
+ if num_invalid > 0
+ call xolox#misc#msg#warn("easytags.vim %s: Ignored %i invalid line(s) in %s!", g:easytags_version, num_invalid, a:tagsfile)
+ endif
return [headers, entries]
endfunction
function! xolox#easytags#parse_entry(line) " {{{2
- return matchlist(a:line, '^\([^\t]\+\)\t\([^\t]\+\)\t\(.\+\)$')[1:3]
+ let fields = split(a:line, '\t')
+ return len(fields) >= 3 ? fields : []
endfunction
function! xolox#easytags#parse_entries(lines) " {{{2
call map(a:lines, 'xolox#easytags#parse_entry(v:val)')
- return a:lines
+ return filter(a:lines, '!empty(v:val)')
endfunction
function! xolox#easytags#write_tagsfile(tagsfile, headers, entries) " {{{2
View
2  plugin/easytags.vim
@@ -12,7 +12,7 @@ if &cp || exists('g:loaded_easytags')
finish
endif
-let g:easytags_version = '2.4.4'
+let g:easytags_version = '2.4.5'
" Configuration defaults and initialization. {{{1
Please sign in to comment.
Something went wrong with that request. Please try again.