From e02755cd9ff29277d14421c9df627e5dc48e4f67 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Aug 2026 10:07:26 -0400 Subject: fix(options): ":set foo?" for Lua callbacks #41100 Problem: `:set foo=` and `:set foo?` for func/expr options set to a Lua function, always displays "v:lua". The existing "" form was avoided because the ref id N changes on every read of the same option. Solution: - Don't attempt to tab-complete Lua functions. - Show "" (or "" if source file is unknown). Example: :set operatorfunc? operatorfunc= --- src/nvim/lua/executor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/nvim/lua/executor.c') diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index e05da57b3c..bffa924d8f 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -2453,7 +2453,7 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview) /// String representation of a Lua function reference /// /// @return Allocated string -char *nlua_funcref_str(LuaRef ref, Arena *arena) +char *nlua_funcref_str(LuaRef ref, Arena *arena, bool show_ref) { lua_State *const lstate = global_lstate; @@ -2469,13 +2469,14 @@ char *nlua_funcref_str(LuaRef ref, Arena *arena) lua_Debug ar; if (lua_getinfo(lstate, ">S", &ar) && *ar.source == '@' && ar.linedefined >= 0) { char *src = home_replace_save(NULL, ar.source + 1); - String str = arena_printf(arena, "", ref, src, ar.linedefined); + String str = show_ref ? arena_printf(arena, "", ref, src, ar.linedefined) + : arena_printf(arena, "", src, ar.linedefined); xfree(src); return str.data; } plain: {} - return arena_printf(arena, "", ref).data; + return show_ref ? arena_printf(arena, "", ref).data : arena_printf(arena, "").data; } /// Execute the vim._core.defaults module to set up default mappings and autocommands -- cgit