dont allow checkers with duplicate names for the same filetype
This commit is contained in:
parent
c97951b601
commit
0b0dbc56e6
@ -111,9 +111,7 @@ function! s:CompleteCheckerName(argLead, cmdLine, cursorPos)
|
|||||||
let checker_names = []
|
let checker_names = []
|
||||||
for ft in s:CurrentFiletypes()
|
for ft in s:CurrentFiletypes()
|
||||||
for checker in s:registry.availableCheckersFor(ft)
|
for checker in s:registry.availableCheckersFor(ft)
|
||||||
if index(checker_names, checker.name()) == -1
|
call add(checker_names, checker.name())
|
||||||
call add(checker_names, checker.name())
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
return join(checker_names, "\n")
|
return join(checker_names, "\n")
|
||||||
|
@ -31,13 +31,15 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args)
|
|||||||
call registry.registerChecker(checker)
|
call registry.registerChecker(checker)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! g:SyntasticRegistry.registerChecker(checker)
|
function! g:SyntasticRegistry.registerChecker(checker) abort
|
||||||
let ft = a:checker.filetype()
|
let ft = a:checker.filetype()
|
||||||
|
|
||||||
if !has_key(self._checkerMap, ft)
|
if !has_key(self._checkerMap, ft)
|
||||||
let self._checkerMap[ft] = []
|
let self._checkerMap[ft] = []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call self._validateUniqueName(a:checker)
|
||||||
|
|
||||||
call add(self._checkerMap[ft], a:checker)
|
call add(self._checkerMap[ft], a:checker)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -133,4 +135,12 @@ function! g:SyntasticRegistry._userHasFiletypeSettings(filetype)
|
|||||||
return exists("g:syntastic_" . a:filetype . "_checkers")
|
return exists("g:syntastic_" . a:filetype . "_checkers")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! g:SyntasticRegistry._validateUniqueName(checker) abort
|
||||||
|
for checker in self._allCheckersFor(a:checker.filetype())
|
||||||
|
if checker.name() == a:checker.name()
|
||||||
|
throw "Syntastic: Duplicate syntax checker name for: " . a:checker.name()
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
Loading…
Reference in New Issue
Block a user