diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/remote/host.vim | 12 | ||||
-rw-r--r-- | runtime/doc/msgpack_rpc.txt | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index b07593f39b..ebbd85b6e6 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -133,6 +133,11 @@ function! s:RegistrationCommands(host) let lines = [] for path in paths let specs = rpcrequest(channel, 'specs', path) + if type(specs) != type([]) + " host didn't return a spec list, indicates a failure while loading a + " plugin + continue + endif call add(lines, "call remote#host#RegisterPlugin('".a:host \ ."', '".path."', [") for spec in specs @@ -244,9 +249,10 @@ function! s:RequirePythonHost(name) endif catch endtry - throw 'Failed to load python host.' . - \ " Try upgrading the Neovim python module with 'pip install --upgrade neovim'" . - \ " or see ':help nvim-python'." + throw 'Failed to load python host. You can try to see what happened ' . + \ 'by starting Neovim with $NVIM_PYTHON_PYTHON_LOG and opening '. + \ 'the generated log file. Also, the host stderr will be available '. + \ 'in Neovim log, so it may contain useful information.' endfunction call remote#host#Register('python', function('s:RequirePythonHost')) diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index f3fcd069c4..b6142e2234 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -116,6 +116,12 @@ functions can be called interactively: >>> nvim = attach('socket', path='[address]') >>> nvim.command('echo "hello world!"') < +One can also spawn and connect to an embedded nvim instance via |rpcstart()| +> + let vim = rpcstart('nvim', ['--embed']) + echo rpcrequest(vim, 'vim_eval', '"Hello " . "world!"') + call rpcstop(vim) +< ============================================================================== 4. Implementing new clients *msgpack-rpc-clients* @@ -177,6 +183,10 @@ Buffer -> enum value kObjectTypeBuffer Window -> enum value kObjectTypeWindow Tabpage -> enum value kObjectTypeTabpage +An API method expecting one of these types may be passed an integer instead, +although they are not interchangeable. For example, a Buffer may be passed as +an integer, but not a Window or Tabpage. + The most reliable way of determining the type codes for the special nvim types is at runtime by inspecting the `types` key of metadata dictionary returned by `vim_get_api_info` method. Here's an example json representation of the @@ -216,7 +226,7 @@ that makes this task easier: - Methods that operate instances of Nvim's types are prefixed with the type name in lower case, e.g. `buffer_get_line` represents the `get_line` method of a Buffer instance. -- Global methods are prefixed with `vim`, e.g. `vim_list_buffers`. +- Global methods are prefixed with `vim`, e.g. `vim_get_buffers`. So, for an object-oriented language, a client library would have the classes that represent Nvim's types, and the methods of each class could be defined |