Improve deoplete source performance
This commit is contained in:
parent
23eac4b080
commit
aa37cd0fbe
@ -33,14 +33,16 @@ class Source(Base):
|
|||||||
self.name = 'neosnippet'
|
self.name = 'neosnippet'
|
||||||
self.mark = '[ns]'
|
self.mark = '[ns]'
|
||||||
self.rank = 200
|
self.rank = 200
|
||||||
|
self.__cache = {}
|
||||||
|
|
||||||
def gather_candidates(self, context):
|
def on_event(self, context):
|
||||||
return self.vim.eval(
|
self.__cache[context['filetype']] = self.vim.eval(
|
||||||
'values(neosnippet#helpers#get_completion_snippets())')
|
'values(neosnippet#helpers#get_completion_snippets())')
|
||||||
|
for candidate in self.__cache[context['filetype']]:
|
||||||
def on_post_filter(self, context):
|
|
||||||
for candidate in context['candidates']:
|
|
||||||
candidate['dup'] = 1
|
candidate['dup'] = 1
|
||||||
candidate['menu'] = candidate['menu_abbr']
|
candidate['menu'] = candidate['menu_abbr']
|
||||||
return context['candidates']
|
|
||||||
|
|
||||||
|
def gather_candidates(self, context):
|
||||||
|
if not self.__cache:
|
||||||
|
self.on_event(context)
|
||||||
|
return self.__cache.get(context['filetype'], [])
|
||||||
|
Loading…
Reference in New Issue
Block a user