summaryrefslogtreecommitdiff
path: root/rplugin
diff options
context:
space:
mode:
Diffstat (limited to 'rplugin')
-rw-r--r--rplugin/python3/deoplete/__init__.py29
-rw-r--r--rplugin/python3/deoplete/deoplete.py5
2 files changed, 12 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)
diff --git a/rplugin/python3/deoplete/deoplete.py b/rplugin/python3/deoplete/deoplete.py
index 6055d81..f1fd9e4 100644
--- a/rplugin/python3/deoplete/deoplete.py
+++ b/rplugin/python3/deoplete/deoplete.py
@@ -39,6 +39,11 @@ class Deoplete(logger.LoggingMixin):
self._loaded_paths = set()
self._prev_results = {}
+ # on_init() call
+ context = self._vim.call('deoplete#init#_context', 'Init', [])
+ context['rpc'] = 'deoplete_on_event'
+ self.on_event(context)
+
def completion_begin(self, context):
self.check_recache(context)