diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index e2ba7290..d54fb8d7 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -111,9 +111,7 @@ function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) let checker_names = [] for ft in s:CurrentFiletypes() for checker in s:registry.availableCheckersFor(ft) - if index(checker_names, checker.name()) == -1 - call add(checker_names, checker.name()) - endif + call add(checker_names, checker.name()) endfor endfor return join(checker_names, "\n") diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 7709120c..9e61d229 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -31,13 +31,15 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) call registry.registerChecker(checker) endfunction -function! g:SyntasticRegistry.registerChecker(checker) +function! g:SyntasticRegistry.registerChecker(checker) abort let ft = a:checker.filetype() if !has_key(self._checkerMap, ft) let self._checkerMap[ft] = [] endif + call self._validateUniqueName(a:checker) + call add(self._checkerMap[ft], a:checker) endfunction @@ -133,4 +135,12 @@ function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) return exists("g:syntastic_" . a:filetype . "_checkers") 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: