diff options
Diffstat (limited to 'rplugin/python3/deoplete/__init__.py')
-rw-r--r-- | rplugin/python3/deoplete/__init__.py | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/rplugin/python3/deoplete/__init__.py b/rplugin/python3/deoplete/__init__.py index 4644b52..44f90c9 100644 --- a/rplugin/python3/deoplete/__init__.py +++ b/rplugin/python3/deoplete/__init__.py @@ -21,36 +21,21 @@ class DeopleteHandlers(object): self._vim = vim @neovim.function('_deoplete', sync=True) - def init_python(self, args): - self._deoplete = Deoplete(self._vim) + def init_channel(self, args): self._vim.vars['deoplete#_channel_id'] = self._vim.channel_id - # Check neovim-python version. try: import pkg_resources version = [pkg_resources.get_distribution('neovim').version] except Exception: - # Since neovim-client version 0.1.11 - if hasattr(neovim, 'VERSION'): - version = ['{major}.{minor}.{patch}{prerelease}'.format( - major=neovim.VERSION.major, - minor=neovim.VERSION.minor, - patch=neovim.VERSION.patch, - prerelease=getattr(neovim.VERSION, 'prerelease', '') - )] - else: - version = [] - python_dir = os.path.dirname(os.path.dirname(neovim.__file__)) - base = python_dir + '/neovim-*/' - meta_files = glob(base + 'PKG-INFO') + glob(base + '/METADATA') - for metadata in meta_files: - with open(metadata, 'r', errors='replace') as f: - for line in f: - m = re.match('Version: (.+)', line) - if m: - version.append(m.group(1)) + version = 'unknown' self._vim.vars['deoplete#_neovim_python_version'] = version + @neovim.rpc_export('deoplete_init') + def init(self): + self._deoplete = Deoplete(self._vim) + self._vim.vars['deoplete#_initialized'] = 1 + @neovim.rpc_export('deoplete_enable_logging') def enable_logging(self, level, logfile): logger.setup(self._vim, level, logfile) |