diff options
-rw-r--r-- | autoload/deoplete/handler.vim | 16 | ||||
-rw-r--r-- | rplugin/python3/deoplete/delay.py | 24 | ||||
-rw-r--r-- | rplugin/python3/deoplete/deoplete.py | 7 |
3 files changed, 7 insertions, 40 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim index 3983f14..fb27120 100644 --- a/autoload/deoplete/handler.vim +++ b/autoload/deoplete/handler.vim @@ -11,8 +11,8 @@ function! deoplete#handler#_init() abort "{{{ autocmd CompleteDone * call s:complete_done() autocmd InsertCharPre * call s:on_insert_char_pre() - autocmd TextChangedI * call s:completion_begin("TextChangedI", 0) - autocmd InsertEnter * call s:completion_begin("InsertEnter", 0) + autocmd TextChangedI * call s:completion_begin("TextChangedI") + autocmd InsertEnter * call s:completion_begin("InsertEnter") augroup END for event in [ @@ -24,14 +24,10 @@ function! deoplete#handler#_init() abort "{{{ call s:on_event('') endfunction"}}} -function! deoplete#handler#_delay_trigger() abort "{{{ - call s:completion_begin('TextChangedI', 1) -endfunction"}}} - -function! s:completion_begin(event, delayed) abort "{{{ +function! s:completion_begin(event) abort "{{{ let context = deoplete#init#_context(a:event, []) - if !a:delayed && s:is_skip(a:event, context) + if s:is_skip(a:event, context) return endif @@ -40,10 +36,6 @@ function! s:completion_begin(event, delayed) abort "{{{ let g:deoplete#_context.refresh = 0 - if a:delayed - let context.delay = 0 - endif - " Call omni completion for filetype in context.filetypes for pattern in deoplete#util#convert2list( diff --git a/rplugin/python3/deoplete/delay.py b/rplugin/python3/deoplete/delay.py deleted file mode 100644 index b308da2..0000000 --- a/rplugin/python3/deoplete/delay.py +++ /dev/null @@ -1,24 +0,0 @@ -# ============================================================================ -# FILE: delay.py -# AUTHOR: Tommy Allen <tommy at esdf.io> -# License: MIT license -# ============================================================================ - -from threading import Timer - - -class DelayTimer(object): - """Reusable timer for delayed completions.""" - - def __init__(self, vim): - self.timer = None - self.vim = vim - - def callback(self): - self.vim.async_call(self.vim.call, 'deoplete#handler#_delay_trigger') - - def start(self, interval): - if self.timer is not None: - self.timer.cancel() - self.timer = Timer(interval, self.callback) - self.timer.start() diff --git a/rplugin/python3/deoplete/deoplete.py b/rplugin/python3/deoplete/deoplete.py index c51fe01..bc349d3 100644 --- a/rplugin/python3/deoplete/deoplete.py +++ b/rplugin/python3/deoplete/deoplete.py @@ -7,7 +7,6 @@ from deoplete.util import \ error, globruntime, charpos2bytepos, \ bytepos2charpos, get_custom, get_syn_name, get_buffer_config -from deoplete.delay import DelayTimer import deoplete.source import deoplete.filter @@ -35,13 +34,13 @@ class Deoplete(logger.LoggingMixin): self.__custom = [] self.__profile_flag = None self.__profile_start = 0 - self.__delay = DelayTimer(vim) self.name = 'core' def completion_begin(self, context): if context['event'] != 'Manual' and context['delay'] > 0: - self.__delay.start(context['delay'] / 1000.0) - return + time.sleep(context['delay'] / 1000.0) + if self.position_has_changed(context['changedtick']): + return try: complete_position, candidates = self.gather_candidates(context) |