mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 03:46:31 +00:00
api: allow nvim_buf_attach from lua using callbacks
This commit is contained in:
@@ -104,6 +104,7 @@ typedef enum {
|
||||
kObjectTypeString,
|
||||
kObjectTypeArray,
|
||||
kObjectTypeDictionary,
|
||||
kObjectTypeLuaRef,
|
||||
// EXT types, cannot be split or reordered, see #EXT_OBJECT_TYPE_SHIFT
|
||||
kObjectTypeBuffer,
|
||||
kObjectTypeWindow,
|
||||
@@ -119,6 +120,7 @@ struct object {
|
||||
String string;
|
||||
Array array;
|
||||
Dictionary dictionary;
|
||||
LuaRef luaref;
|
||||
} data;
|
||||
};
|
||||
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/handle.h"
|
||||
#include "nvim/msgpack_rpc/helpers.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/assert.h"
|
||||
#include "nvim/vim.h"
|
||||
@@ -1147,6 +1148,10 @@ void api_free_object(Object value)
|
||||
api_free_dictionary(value.data.dictionary);
|
||||
break;
|
||||
|
||||
case kObjectTypeLuaRef:
|
||||
executor_free_luaref(value.data.luaref);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
@@ -48,6 +48,10 @@
|
||||
.type = kObjectTypeDictionary, \
|
||||
.data.dictionary = d })
|
||||
|
||||
#define LUAREF_OBJ(r) ((Object) { \
|
||||
.type = kObjectTypeLuaRef, \
|
||||
.data.luaref = r })
|
||||
|
||||
#define NIL ((Object) {.type = kObjectTypeNil})
|
||||
|
||||
#define PUT(dict, k, v) \
|
||||
|
Reference in New Issue
Block a user