mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
feat(autocmds): retrieve lua callback (#18642)
add a new `callback` field to `nvim_get_autocmds`
This commit is contained in:
@@ -1205,6 +1205,30 @@ void callback_copy(Callback *dest, Callback *src)
|
||||
}
|
||||
}
|
||||
|
||||
/// Generate a string description of a callback
|
||||
char *callback_to_string(Callback *cb)
|
||||
{
|
||||
size_t msglen = 100;
|
||||
char *msg = (char *)xmallocz(msglen);
|
||||
|
||||
switch (cb->type) {
|
||||
case kCallbackLua:
|
||||
snprintf(msg, msglen, "<lua: %d>", cb->data.luaref);
|
||||
break;
|
||||
case kCallbackFuncref:
|
||||
// TODO(tjdevries): Is this enough space for this?
|
||||
snprintf(msg, msglen, "<vim function: %s>", cb->data.funcref);
|
||||
break;
|
||||
case kCallbackPartial:
|
||||
snprintf(msg, msglen, "<vim partial: %s>", cb->data.partial->pt_name);
|
||||
break;
|
||||
default:
|
||||
snprintf(msg, msglen, "%s", "");
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// Remove watcher from a dictionary
|
||||
///
|
||||
/// @param dict Dictionary to remove watcher from.
|
||||
|
Reference in New Issue
Block a user