Skip to content

Commit 9713f0a

Browse files
committed
Bug fix: Support for disabled languages in Exuberant Ctags (issue #62)
See issue #62 on GitHub: #62
1 parent 330ec57 commit 9713f0a

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

autoload/xolox/easytags.vim

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: August 31, 2013
3+
" Last Change: September 1, 2013
44
" URL: http://peterodding.com/code/vim/easytags/
55

6-
let g:xolox#easytags#version = '3.4.2'
6+
let g:xolox#easytags#version = '3.4.3'
77

88
" Plug-in initialization. {{{1
99

@@ -566,21 +566,23 @@ function! xolox#easytags#supported_filetypes() " {{{2
566566
let command = g:easytags_cmd . ' --list-languages'
567567
let listing = xolox#misc#os#exec({'command': command})['stdout']
568568
endif
569-
let s:supported_filetypes = map(copy(listing) + keys(xolox#misc#option#get('easytags_languages', {})), 's:check_filetype(listing, v:val)')
569+
let s:supported_filetypes = keys(xolox#misc#option#get('easytags_languages', {}))
570+
for line in listing
571+
if line =~ '\[disabled\]$'
572+
" Ignore languages that have been explicitly disabled using `--languages=-Vim'.
573+
continue
574+
elseif line =~ '^\w\S*$'
575+
call add(s:supported_filetypes, xolox#easytags#to_vim_ft(line))
576+
elseif line =~ '\S'
577+
call xolox#misc#msg#warn("easytags.vim %s: Failed to parse line of output from ctags --list-languages: %s", g:xolox#easytags#version, string(line))
578+
endif
579+
endfor
570580
let msg = "easytags.vim %s: Retrieved %i supported languages in %s."
571581
call xolox#misc#timer#stop(msg, g:xolox#easytags#version, len(s:supported_filetypes), starttime)
572582
endif
573583
return s:supported_filetypes
574584
endfunction
575585

576-
function! s:check_filetype(listing, cline)
577-
if a:cline !~ '^\w\S*$'
578-
let msg = "Failed to get supported languages! (output: %s)"
579-
throw printf(msg, strtrans(join(a:listing, "\n")))
580-
endif
581-
return xolox#easytags#to_vim_ft(a:cline)
582-
endfunction
583-
584586
function! xolox#easytags#select_supported_filetypes(vim_ft) " {{{2
585587
let supported_filetypes = xolox#easytags#supported_filetypes()
586588
let applicable_filetypes = []

0 commit comments

Comments
 (0)