|
12 | 12 | stdio_session, tcp_session)
|
13 | 13 | from .plugin import (Host, autocmd, command, decode, encoding, function,
|
14 | 14 | plugin, rpc_export, shutdown_hook)
|
| 15 | +from .util import Version |
15 | 16 |
|
16 | 17 |
|
17 | 18 | __all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session',
|
18 | 19 | 'start_host', 'autocmd', 'command', 'encoding', 'decode',
|
19 |
| - 'function', 'plugin', 'rpc_export', 'Host', 'Nvim', |
| 20 | + 'function', 'plugin', 'rpc_export', 'Host', 'Nvim', 'VERSION', |
20 | 21 | 'shutdown_hook', 'attach', 'setup_logging', 'ErrorResponse')
|
21 | 22 |
|
22 | 23 |
|
| 24 | +VERSION = Version(major=0, minor=1, patch=11, prerelease="dev") |
| 25 | + |
| 26 | + |
23 | 27 | def start_host(session=None):
|
24 | 28 | """Promote the current process into python plugin host for Nvim.
|
25 | 29 |
|
@@ -64,7 +68,14 @@ def start_host(session=None):
|
64 | 68 |
|
65 | 69 | if not session:
|
66 | 70 | session = stdio_session()
|
67 |
| - host = Host(Nvim.from_session(session)) |
| 71 | + nvim = Nvim.from_session(session) |
| 72 | + |
| 73 | + if nvim.version.api_level < 1: |
| 74 | + sys.stderr.write("This version of the neovim python package " |
| 75 | + "requires nvim 0.1.6 or later") |
| 76 | + sys.exit(1) |
| 77 | + |
| 78 | + host = Host(nvim) |
68 | 79 | host.start(plugins)
|
69 | 80 |
|
70 | 81 |
|
|
0 commit comments