mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00

problem: can we have Serde? solution: we have Serde at home This by itself is just a change of notation, that could be quickly merged to avoid messy merge conflicts, but upcoming changes are planned: - keysets no longer need to be defined in one single file. `keysets.h` is just the initial automatic conversion of the previous `keysets.lua`. keysets just used in a single api/{scope}.h can be moved to that file, later on. - Typed dicts will have more specific types than Object. this will enable most of the existing manual typechecking boilerplate to be eliminated. We will need some annotation for missing value, i e a boolean will need to be represented as a TriState (none/false/true) in some cases. - Eventually: optional parameters in form of a `Dict opts` final parameter will get added in some form to metadata. this will require a discussion/desicion about type forward compatibility.
35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
#ifndef NVIM_API_PRIVATE_DISPATCH_H
|
|
#define NVIM_API_PRIVATE_DISPATCH_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "nvim/api/private/defs.h"
|
|
#include "nvim/memory.h"
|
|
#include "nvim/types.h"
|
|
|
|
typedef Object (*ApiDispatchWrapper)(uint64_t channel_id, Array args, Arena *arena, Error *error);
|
|
|
|
/// The rpc_method_handlers table, used in msgpack_rpc_dispatch(), stores
|
|
/// functions of this type.
|
|
struct MsgpackRpcRequestHandler {
|
|
const char *name;
|
|
ApiDispatchWrapper fn;
|
|
bool fast; // Function is safe to be executed immediately while running the
|
|
// uv loop (the loop is run very frequently due to breakcheck).
|
|
// If "fast" is false, the function is deferred, i e the call will
|
|
// be put in the event queue, for safe handling later.
|
|
bool arena_return; // return value is allocated in the arena (or statically)
|
|
// and should not be freed as such.
|
|
};
|
|
|
|
extern const MsgpackRpcRequestHandler method_handlers[];
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "api/private/dispatch.h.generated.h"
|
|
# include "api/private/dispatch_wrappers.h.generated.h"
|
|
# include "keysets_defs.generated.h"
|
|
#endif
|
|
|
|
#endif // NVIM_API_PRIVATE_DISPATCH_H
|