aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/msgpack_rpc.txt26
1 files changed, 12 insertions, 14 deletions
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt
index c5c0392d96..8d013dceb2 100644
--- a/runtime/doc/msgpack_rpc.txt
+++ b/runtime/doc/msgpack_rpc.txt
@@ -197,7 +197,7 @@ prefix is stripped off.
5. Types *rpc-types*
The Nvim C API uses custom types for all functions. |api-types|
-For the purpose of mapping to msgpack, the types can be split into two groups:
+At the RPC layer, the types can be split into two groups:
- Basic types that map natively to msgpack (and probably have a default
representation in msgpack-supported programming languages)
@@ -219,18 +219,16 @@ Special types (msgpack EXT) ~
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 as a Window or Tabpage. The data in the EXT object is the
-object id encodes as a msgpack integer. For buffers this is equal to the
-buffer number and for windows the window id. For tabpages this is not equal to
-tabpage numbers.
-
-The most reliable way of determining the type codes for the special Nvim types
-is to inspect the `types` key of metadata dictionary returned by the
-`nvim_get_api_info` method at runtime. Here's a sample JSON representation of
-the `types` object:
->
+API functions expecting one of the special EXT types may be passed an integer
+instead, but not another EXT type. E.g. Buffer may be passed as an integer but
+not as a Window or Tabpage. The EXT object data is the object id encoded as
+a msgpack integer: For buffers this is the |bufnr()| and for windows the
+|window-ID|. For tabpages the id is an internal handle, not the tabpage
+number.
+
+To determine the type codes of the special EXT types, inspect the `types` key
+of the |api-metadata| at runtime. Example JSON representation: >
+
"types": {
"Buffer": {
"id": 0,
@@ -245,7 +243,7 @@ the `types` object:
"prefix": "nvim_tabpage_"
}
}
-<
+
Even for statically compiled clients it is good practice to avoid hardcoding
the type codes, because a client may be built against one Nvim version but
connect to another with different type codes.