diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1bbca888..5c2e770b 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -57,14 +57,14 @@ if !exists("g:syntastic_filetype_map") endif let s:registry = g:SyntasticRegistry.Instance() -let s:notifiers = g:SyntasticNotifiers.New() +let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) let checker_names = [] for ft in s:CurrentFiletypes() for checker in s:registry.availableCheckersFor(ft) - call add(checker_names, checker.name()) + call add(checker_names, checker.getName()) endfor endfor return join(checker_names, "\n") @@ -172,7 +172,7 @@ function! s:CacheErrors(...) endif for checker in checkers - call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.name()) + call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) let loclist = checker.getLocList() @@ -258,7 +258,7 @@ endfunction function! SyntasticStatuslineFlag() let loclist = g:SyntasticLoclist.current() let issues = loclist.filteredRaw() - let num_issues = loclist.length() + let num_issues = loclist.getLength() if loclist.hasErrorsOrWarningsToDisplay() let errors = loclist.errors() let warnings = loclist.warnings() diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 5f4e8fd3..a5a54cba 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -27,11 +27,11 @@ function! g:SyntasticChecker.New(args) return newObj endfunction -function! g:SyntasticChecker.filetype() +function! g:SyntasticChecker.getFiletype() return self._filetype endfunction -function! g:SyntasticChecker.name() +function! g:SyntasticChecker.getName() return self._name endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 2dd0bd5a..637c6b82 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -55,7 +55,7 @@ function! g:SyntasticLoclist.isEmpty() return empty(self._rawLoclist) endfunction -function! g:SyntasticLoclist.length() +function! g:SyntasticLoclist.getLength() return len(self._rawLoclist) endfunction diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 058c695a..2a838883 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -5,6 +5,8 @@ let g:loaded_syntastic_modemap = 1 let g:SyntasticModeMap = {} +" Public methods {{{1 + function! g:SyntasticModeMap.Instance() if !exists('s:SyntasticModeMapInstance') let s:SyntasticModeMapInstance = copy(self) @@ -40,6 +42,8 @@ function! g:SyntasticModeMap.echoMode() echo "Syntastic: " . self._mode . " mode enabled" endfunction +" Private methods {{{1 + function! g:SyntasticModeMap._initModeMapFromGlobalOpts() let self._mode = "active" let self._activeFiletypes = [] @@ -60,3 +64,4 @@ function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) return empty(filter(a:filetypes, 'index(self._passiveFiletypes, v:val) != -1')) endfunction +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 5a7c8432..1a7766aa 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -9,18 +9,13 @@ let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autolocl " Public methods {{{1 -function! g:SyntasticNotifiers.New() - let newObj = copy(self) +function! g:SyntasticNotifiers.Instance() + if !exists('s:SyntasticNotifiersInstance') + let s:SyntasticNotifiersInstance = copy(self) + call s:SyntasticNotifiersInstance._initNotifiers() + endif - let newObj._notifier = {} - for type in s:notifier_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - let newObj._notifier[type] = g:{class}.New() - endfor - - let newObj._enabled_types = copy(s:notifier_types) - - return newObj + return s:SyntasticNotifiersInstance endfunction function! g:SyntasticNotifiers.refresh(loclist) @@ -41,4 +36,16 @@ function! g:SyntasticNotifiers.reset(loclist) endfor endfunction +" Private methods {{{1 + +function! g:SyntasticNotifiers._initNotifiers() + let self._notifier = {} + for type in s:notifier_types + let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') + let self._notifier[type] = g:{class}.New() + endfor + + let self._enabled_types = copy(s:notifier_types) +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 3905324f..9842809b 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -47,7 +47,7 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) endfunction function! g:SyntasticRegistry.registerChecker(checker) abort - let ft = a:checker.filetype() + let ft = a:checker.getFiletype() if !has_key(self._checkerMap, ft) let self._checkerMap[ft] = [] @@ -85,7 +85,7 @@ endfunction function! g:SyntasticRegistry.getChecker(ftalias, name) for checker in self.availableCheckersFor(a:ftalias) - if checker.name() == a:name + if checker.getName() == a:name return checker endif endfor @@ -109,8 +109,8 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) call extend(active, self.getActiveCheckers(ftalias)) endfor - echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.name()"))) - echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.name()"))) + echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.getName()"))) + echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()"))) endfunction " Private methods {{{1 @@ -127,7 +127,7 @@ endfunction function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetype) if has_key(s:defaultCheckers, a:filetype) let whitelist = s:defaultCheckers[a:filetype] - return filter(a:checkers, "index(whitelist, v:val.name()) != -1") + return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") endif return a:checkers @@ -139,7 +139,7 @@ function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype) else let whitelist = g:syntastic_{a:filetype}_checkers endif - return filter(a:checkers, "index(whitelist, v:val.name()) != -1") + return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") endfunction function! g:SyntasticRegistry._filterCheckersByAvailability(checkers) @@ -171,9 +171,9 @@ function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) 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() + for checker in self._allCheckersFor(a:checker.getFiletype()) + if checker.getName() == a:checker.getName() + throw "Syntastic: Duplicate syntax checker name for: " . a:checker.getName() endif endfor endfunction diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 62d62b1c..5cc99b87 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -20,7 +20,12 @@ function! SyntaxCheckers_text_atdtool_IsAvailable() endfunction function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) - return matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') + let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') + if term != '' + let col = get(a:item, 'col', 0) + let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term + endif + return term endfunction function! SyntaxCheckers_text_atdtool_GetLocList()