diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-12-01 16:44:36 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2018-12-03 10:42:00 +0100 |
commit | 8b42249cddf6b257e2eee808a41f3d6dd5af6846 (patch) | |
tree | 72de67ecda2504f44f5183daaddb60809e855415 /runtime | |
parent | 07ad5d71ab97a84dc9c59b3507bf7898040d24cf (diff) | |
download | rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.tar.gz rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.tar.bz2 rneovim-8b42249cddf6b257e2eee808a41f3d6dd5af6846.zip |
RPC: turn errors from async calls into notifications
Previously, nvim sent a response with invalid request id (UINT64_MAX).
In functionaltests, catch unexpected error notifications in after_each().
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/api.txt | 17 | ||||
-rw-r--r-- | runtime/doc/develop.txt | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 66fb5bda82..0219488088 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -80,6 +80,19 @@ As Nvim evolves the API may change in compliance with this CONTRACT: - Deprecated functions will not be removed until Nvim version 2.0 ============================================================================== +Global events *api-global-events* + +When a client invokes an API request as an async notification, it is not +possible for Nvim to send an error response. Instead, in case of error, the +following notification will be sent to the client: + + *nvim_error_event* +nvim_error_event[{type}, {message}] + +{type} is a numeric id as defined by `api_info().error_types`, and {message} is +a string with the error message. + +============================================================================== Buffer update events *api-buffer-updates* API clients can "attach" to Nvim buffers to subscribe to buffer update events. @@ -206,7 +219,7 @@ Example using the Nvim python-client: buf.clear_highlight(src) < If the highlights don't need to be deleted or updated, just pass -1 as -src_id (this is the default in python). Use |nvim_buf_clear_highlight()| to +src_id (this is the default in python). Use |nvim_buf_clear_namespace()| to clear highlights from a specific source, in a specific line range or the entire buffer by passing in the line range 0, -1 (the latter is the default in python as used above). @@ -218,7 +231,7 @@ An example of calling the api from vimscript: > call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1) " later - call nvim_buf_clear_highlight(0, src, 0, -1) + call nvim_buf_clear_namespace(0, src, 0, -1) > ============================================================================== Global Functions *api-global* diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index bcf43142ad..2c919f9104 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -181,6 +181,8 @@ Standard Features ~ - Clients should call |nvim_set_client_info()| after connecting, so users and plugins can detect the client by handling the |ChanInfo| event. This avoids the need for special variables or other client hints. +- Clients should handle |nvim_error_event| notifications, which will be sent + if an async request to nvim was rejected or caused an error. Package Naming ~ |