def _PatchBasedOnVimVersion(self): if vimsupport.VimVersionAtLeast("7.4.774"): self._HasCompletionsThatCouldBeCompletedWithMoreText = \ self._HasCompletionsThatCouldBeCompletedWithMoreText_NewerVim self._FilterToMatchingCompletions = \ self._FilterToMatchingCompletions_NewerVim else: self._FilterToMatchingCompletions = \ self._FilterToMatchingCompletions_OlderVim self._HasCompletionsThatCouldBeCompletedWithMoreText = \ self._HasCompletionsThatCouldBeCompletedWithMoreText_OlderVim
def _AddUltiSnipsDataIfNeeded(self, extra_data): # See :h UltiSnips#SnippetsInCurrentScope. # Errors when evaluating Vim expressions are not caught by Python # try/except blocks prior to Vim 7.4.107. We check that the UltiSnips # function exists for these versions. # TODO: remove this when bumping version requirement to 7.4.107 or greater. if (not vimsupport.VimVersionAtLeast("7.4.107") and not vimsupport.GetBoolValue( "exists( '*UltiSnips#SnippetsInCurrentScope' )")): return try: vim.eval('UltiSnips#SnippetsInCurrentScope( 1 )') except vim.error: return snippets = vimsupport.GetVariableValue('g:current_ulti_dict_info') extra_data['ultisnips_snippets'] = [{ 'trigger': trigger, 'description': snippet['description'] } for trigger, snippet in iteritems(snippets)]