feat(options): lua closure/function options

Problem:
Cannot assign Lua functions/closures to "func" ('completefunc',
'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options.

Solution:
- Store "func"/"expr" options as `Callback` instead of string.
- Delete oceans of copy-pasted code.
- BREAKING: LuaRef returned via RPC/Vimscript is now represented as
  `"<Lua N: file:line>"` (like what `:map` shows) instead of `nil`.
- Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin.

Helped-by: Lewis Russell <lewis6991@gmail.com>
This commit is contained in:
Justin M. Keyes
2026-07-29 19:09:48 +02:00
parent 917232b508
commit 726d1a92d2
55 changed files with 778 additions and 572 deletions

View File

@@ -846,12 +846,12 @@ function lsp._set_defaults(client, bufnr)
if
client:supports_method('textDocument/definition') and is_empty_or_default(bufnr, 'tagfunc')
then
vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
vim.bo[bufnr].tagfunc = lsp.tagfunc
end
if
client:supports_method('textDocument/completion') and is_empty_or_default(bufnr, 'omnifunc')
then
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
vim.bo[bufnr].omnifunc = lsp.omnifunc
end
if
client:supports_method('textDocument/rangeFormatting')