def _AddSyntaxDataIfNeeded(self, extra_data): if not self._user_options['seed_identifiers_with_syntax']: return filetype = vimsupport.CurrentFiletypes()[0] if filetype in self._filetypes_with_keywords_loaded: return self._filetypes_with_keywords_loaded.add(filetype) extra_data['syntax_keywords'] = list( syntax_parse.SyntaxKeywordsForCurrentBuffer())
def AddIdentifiersFromSyntax(self): filetype = vim.eval("&filetype") if filetype in self.filetypes_with_keywords_loaded: return self.filetypes_with_keywords_loaded.add(filetype) keyword_set = syntax_parse.SyntaxKeywordsForCurrentBuffer() keywords = ycm_core.StringVec() for keyword in keyword_set: keywords.append(keyword) filepath = SYNTAX_FILENAME + filetype self.completer.AddIdentifiersToDatabase(keywords, filetype, filepath)