mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
doc: channel, eventloop
This commit is contained in:
parent
c00a33ed19
commit
cdd9e868ef
@ -215,6 +215,7 @@ static void ui_set_option(UI *ui, String name, Object value, Error *error)
|
|||||||
#undef UI_EXT_OPTION
|
#undef UI_EXT_OPTION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Pushes data into UI.UIData, to be consumed later by remote_ui_flush().
|
||||||
static void push_call(UI *ui, char *name, Array args)
|
static void push_call(UI *ui, char *name, Array args)
|
||||||
{
|
{
|
||||||
Array call = ARRAY_DICT_INIT;
|
Array call = ARRAY_DICT_INIT;
|
||||||
|
@ -255,12 +255,11 @@ free_vim_args:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute lua code. Parameters might be passed, they are available inside
|
/// Execute lua code. Parameters (if any) are available as `...` inside the
|
||||||
/// the chunk as `...`. The chunk can return a value.
|
/// chunk. The chunk can return a value.
|
||||||
///
|
///
|
||||||
/// To evaluate an expression, it must be prefixed with "return ". For
|
/// Only statements are executed. To evaluate an expression, prefix it
|
||||||
/// instance, to call a lua function with arguments sent in and get its
|
/// with `return`: return my_function(...)
|
||||||
/// return value back, use the code "return my_function(...)".
|
|
||||||
///
|
///
|
||||||
/// @param code lua code to execute
|
/// @param code lua code to execute
|
||||||
/// @param args Arguments to the code
|
/// @param args Arguments to the code
|
||||||
@ -423,29 +422,18 @@ void nvim_del_var(String name, Error *err)
|
|||||||
dict_set_var(&globvardict, name, NIL, true, false, err);
|
dict_set_var(&globvardict, name, NIL, true, false, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets a global variable
|
|
||||||
///
|
|
||||||
/// @deprecated
|
/// @deprecated
|
||||||
///
|
/// @see nvim_set_var
|
||||||
/// @param name Variable name
|
|
||||||
/// @param value Variable value
|
|
||||||
/// @param[out] err Error details, if any
|
|
||||||
/// @return Old value or nil if there was no previous value.
|
/// @return Old value or nil if there was no previous value.
|
||||||
///
|
/// @warning May return nil if there was no previous value
|
||||||
/// @warning It may return nil if there was no previous value
|
/// OR if previous value was `v:null`.
|
||||||
/// or if previous value was `v:null`.
|
|
||||||
Object vim_set_var(String name, Object value, Error *err)
|
Object vim_set_var(String name, Object value, Error *err)
|
||||||
{
|
{
|
||||||
return dict_set_var(&globvardict, name, value, false, true, err);
|
return dict_set_var(&globvardict, name, value, false, true, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes a global variable
|
|
||||||
///
|
|
||||||
/// @deprecated
|
/// @deprecated
|
||||||
///
|
/// @see nvim_del_var
|
||||||
/// @param name Variable name
|
|
||||||
/// @param[out] err Error details, if any
|
|
||||||
/// @return Old value
|
|
||||||
Object vim_del_var(String name, Error *err)
|
Object vim_del_var(String name, Error *err)
|
||||||
{
|
{
|
||||||
return dict_set_var(&globvardict, name, NIL, true, true, err);
|
return dict_set_var(&globvardict, name, NIL, true, true, err);
|
||||||
|
@ -66,6 +66,7 @@ void loop_poll_events(Loop *loop, int ms)
|
|||||||
/// means `fast_events` is NOT processed in an "editor mode"
|
/// means `fast_events` is NOT processed in an "editor mode"
|
||||||
/// (VimState.execute), so redraw and other side-effects are likely to be
|
/// (VimState.execute), so redraw and other side-effects are likely to be
|
||||||
/// skipped.
|
/// skipped.
|
||||||
|
/// @see loop_schedule_deferred
|
||||||
void loop_schedule(Loop *loop, Event event)
|
void loop_schedule(Loop *loop, Event event)
|
||||||
{
|
{
|
||||||
uv_mutex_lock(&loop->mutex);
|
uv_mutex_lock(&loop->mutex);
|
||||||
|
@ -188,12 +188,11 @@ uint64_t channel_connect(bool tcp, const char *address, int timeout,
|
|||||||
return channel->id;
|
return channel->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends event/arguments to channel
|
/// Publishes an event to a channel.
|
||||||
///
|
///
|
||||||
/// @param id The channel id. If 0, the event will be sent to all
|
/// @param id Channel id. 0 means "broadcast to all subscribed channels"
|
||||||
/// channels that have subscribed to the event type
|
/// @param name Event name (application-defined)
|
||||||
/// @param name The event name, an arbitrary string
|
/// @param args Array of event arguments
|
||||||
/// @param args Array with event arguments
|
|
||||||
/// @return True if the event was sent successfully, false otherwise.
|
/// @return True if the event was sent successfully, false otherwise.
|
||||||
bool channel_send_event(uint64_t id, const char *name, Array args)
|
bool channel_send_event(uint64_t id, const char *name, Array args)
|
||||||
{
|
{
|
||||||
@ -215,7 +214,6 @@ bool channel_send_event(uint64_t id, const char *name, Array args)
|
|||||||
send_event(channel, name, args);
|
send_event(channel, name, args);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO(tarruda): Implement event broadcasting in vimscript
|
|
||||||
broadcast_event(name, args);
|
broadcast_event(name, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user