89c93fc089
Deoplete expects to carry out the filtering of snippets by default, but the UltiSnips source uses UltiSnips#SnippetsInCurrentScope() which filters the returned snippets based on user input. Without is_volatile, Deoplete will cache the first set of results UltiSnips returns and keep trying to filter that, rather than getting a new set of results when the input changes.
23 lines
607 B
Python
23 lines
607 B
Python
from .base import Base
|
|
|
|
class Source(Base):
|
|
def __init__(self, vim):
|
|
Base.__init__(self, vim)
|
|
|
|
self.name = 'ultisnips'
|
|
self.mark = '[US]'
|
|
self.rank = 8
|
|
self.is_volatile = True
|
|
|
|
def gather_candidates(self, context):
|
|
suggestions = []
|
|
snippets = self.vim.eval(
|
|
'UltiSnips#SnippetsInCurrentScope()')
|
|
for trigger in snippets:
|
|
suggestions.append({
|
|
'word': trigger,
|
|
'menu': self.mark + ' ' + snippets.get(trigger, ''),
|
|
'dup': 1
|
|
})
|
|
return suggestions
|