def _AddUltiSnipsDataIfNeeded(extra_data): if not USE_ULTISNIPS_DATA: return try: # Since UltiSnips may run in a different python interpreter (python 3) than # YCM, UltiSnips_Manager singleton is not necessary the same as the one # used by YCM. In particular, it means that we cannot rely on UltiSnips to # set the current filetypes to the singleton. We need to do it ourself. UltiSnips_Manager.reset_buffer_filetypes() UltiSnips_Manager.add_buffer_filetypes(vimsupport.GetVariableValue("&filetype")) rawsnips = UltiSnips_Manager._snips("", True) except: return # UltiSnips_Manager._snips() returns a class instance where: # class.trigger - name of snippet trigger word ( e.g. defn or testcase ) # class.description - description of the snippet extra_data["ultisnips_snippets"] = [{"trigger": x.trigger, "description": x.description} for x in rawsnips]
def _AddUltiSnipsDataIfNeeded( extra_data ): if not USE_ULTISNIPS_DATA: return try: # Since UltiSnips may run in a different python interpreter (python 3) than # YCM, UltiSnips_Manager singleton is not necessary the same as the one # used by YCM. In particular, it means that we cannot rely on UltiSnips to # set the current filetypes to the singleton. We need to do it ourself. UltiSnips_Manager.reset_buffer_filetypes() UltiSnips_Manager.add_buffer_filetypes( vimsupport.GetVariableValue( '&filetype' ) ) rawsnips = UltiSnips_Manager._snips( '', True ) except: return # UltiSnips_Manager._snips() returns a class instance where: # class.trigger - name of snippet trigger word ( e.g. defn or testcase ) # class.description - description of the snippet extra_data[ 'ultisnips_snippets' ] = [ { 'trigger': x.trigger, 'description': x.description } for x in rawsnips ]
def snippetsInit(): global ultisnips_idx ultisnips_idx = 0 UltiSnips_Manager.add_buffer_filetypes('%s.clang_complete' % vim.eval('&filetype'))