feat(api): experimental nvim__exec_lua_fast #35758

Problem:
Remote UIs can't execute lua code when a blocking prompt is waiting for
input. This is needed when implementing IME pre-edit for example.

Solution:
Add an `nvim__exec_lua_fast` experimental API function, which is allowed
to run instead of being queued until after the message has been shown.
This commit is contained in:
fredizzimo
2025-12-01 02:27:02 +02:00
committed by GitHub
parent d62bbe24cb
commit 6ebeb07c56
3 changed files with 50 additions and 0 deletions

View File

@@ -1674,6 +1674,30 @@ nvim__complete_set({index}, {opts}) *nvim__complete_set()*
• winid: (number) floating window id
• bufnr: (number) buffer id in floating window
nvim__exec_lua_fast({code}, {args}) *nvim__exec_lua_fast()*
WARNING: This feature is experimental/unstable.
EXPERIMENTAL: this API may change or be removed in the future.
Like |nvim_exec_lua()|, but can be called during |api-fast| contexts.
Execute Lua code. Parameters (if any) are available as `...` inside the
chunk. The chunk can return a value.
Only statements are executed. To evaluate an expression, prefix it with
`return`: return my_function(...)
Attributes: ~
|api-fast|
|RPC| only
Parameters: ~
• {code} (`string`) Lua code to execute
• {args} (`any[]`) Arguments to the code
Return: ~
(`any`) Return value of Lua code if present or NIL.
nvim__get_runtime({pat}, {all}, {opts}) *nvim__get_runtime()*
Find files in runtime directories

View File

@@ -156,6 +156,8 @@ API
• |nvim_echo()| can create |Progress| messages
• |nvim_open_win()| floating windows can show a 'statusline'. Plugins can use
`style='minimal'` or `:setlocal statusline=` to hide the statusline.
• Added experimental |nvim__exec_lua_fast()| to allow remote API clients to
execute code while nvim is blocking for input.
BUILD