From e0f8304860a8db06bca3ec8cdbd58f3852e5e789 Mon Sep 17 00:00:00 2001 From: delphinus Date: Wed, 19 Jun 2019 13:25:41 +0900 Subject: [PATCH] Add separated func for deoplete Deoplete needs `get_complete_position` method and it has a different signature. It already fetches the input string and attempts to detect the position with `\k*` regexp patterns. --- autoload/ale/completion.vim | 4 ++++ rplugin/python3/deoplete/sources/ale.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index ee156056..284b1e08 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -215,6 +215,10 @@ function! ale#completion#GetCompletionPosition() abort return l:column - len(l:match) - 1 endfunction +function! ale#completion#GetCompletionPositionForDeoplete(input) abort + return match(a:input, '\k*$') +endfunction + function! ale#completion#GetCompletionResult() abort if exists('b:ale_completion_result') return b:ale_completion_result diff --git a/rplugin/python3/deoplete/sources/ale.py b/rplugin/python3/deoplete/sources/ale.py index 98c463e0..653bc4fc 100644 --- a/rplugin/python3/deoplete/sources/ale.py +++ b/rplugin/python3/deoplete/sources/ale.py @@ -27,8 +27,10 @@ class Source(Base): self.input_pattern = r'(\.|::|->)\w*$' # Returns an integer for the start position, as with omnifunc. - def get_completion_position(self): - return self.vim.call('ale#completion#GetCompletionPosition') + def get_complete_position(self, context): + return self.vim.call( + 'ale#completion#GetCompletionPositionForDeoplete', context['input'] + ) def gather_candidates(self, context): # Stop early if ALE can't provide completion data for this buffer.