All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 A Deoplete source for ALE completion via tsserver and LSP.
4 __author__ = 'Joao Paulo, w0rp'
7 from deoplete.source.base import Base
9 # Mock the Base class if deoplete isn't available, as mock isn't available
10 # in the Docker image.
12 def __init__(self, vim):
16 # Make sure this code is valid in Python 2, used for running unit tests.
19 def __init__(self, vim):
20 super(Source, self).__init__(vim)
25 self.is_bytepos = True
26 self.min_pattern_length = 1
27 self.is_volatile = True
28 # Do not forget to update s:trigger_character_map in completion.vim in
29 # updating entries in this map.
30 self.input_patterns = {
32 'rust': r'(\.|::)\w*$',
33 'typescript': r'(\.|\'|")\w*$',
34 'cpp': r'(\.|::|->)\w*$',
38 # Returns an integer for the start position, as with omnifunc.
39 def get_complete_position(self, context):
41 'ale#completion#GetCompletionPositionForDeoplete', context['input']
44 def gather_candidates(self, context):
45 # Stop early if ALE can't provide completion data for this buffer.
46 if not self.vim.call('ale#completion#CanProvideCompletions'):
49 event = context.get('event')
52 result = self.vim.call('ale#completion#GetCompletionResult')
56 if context.get('is_refresh'):
58 "call ale#completion#GetCompletions('ale-callback', "
59 + "{'callback': {completions -> deoplete#auto_complete() }})"