aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-05-02 10:46:23 -0400
committerGitHub <noreply@github.com>2026-05-02 10:46:23 -0400
commitd788dd2811bfbfb0daa915ef974d072075a6bceb (patch)
tree1ef170ffe3819171b3881db63a5aa6fc2bee4056 /runtime/lua/vim
parent22f3b283672bc3e4a8d87cfa18e9764abdf876b7 (diff)
downloadrneovim-d788dd2811bfbfb0daa915ef974d072075a6bceb.tar.gz
rneovim-d788dd2811bfbfb0daa915ef974d072075a6bceb.tar.bz2
rneovim-d788dd2811bfbfb0daa915ef974d072075a6bceb.zip
refactor(excmd): pass fargs to Lua for builtin cmds #39528
Problem: The fallback that tokenizes `eap->arg` by unescaped whitespace (when the parser doesn't pre-split via `EX_EXPAND` etc.) lives in `nlua_do_ucmd`, so only user-command callbacks got `eap.fargs`. Builtin commands routed through `nlua_call_excmd` have to re-parse the args themselves (e.g. `M.ex_lsp`). Solution: - Move the tokenization into `nlua_push_eap` so every Lua handler sees `eap.fargs`. Keep only the `EX_NOSPC` override in `nlua_do_ucmd` (the `nargs=1`/`?` case which is genuinely user-command-specific). - Drop the re-parse in `M.ex_lsp`.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_core/ex_cmd.lua10
-rw-r--r--runtime/lua/vim/_core/swapfile.lua2
-rw-r--r--runtime/lua/vim/_core/tag.lua2
3 files changed, 4 insertions, 10 deletions
diff --git a/runtime/lua/vim/_core/ex_cmd.lua b/runtime/lua/vim/_core/ex_cmd.lua
index a1a7ddb07d..2c3b73dd7e 100644
--- a/runtime/lua/vim/_core/ex_cmd.lua
+++ b/runtime/lua/vim/_core/ex_cmd.lua
@@ -174,19 +174,13 @@ local available_subcmds = vim.tbl_keys(actions)
--- Implements command: `:lsp {subcmd} {name}?`.
--- @param eap vim._core.ExCmdArgs
function M.ex_lsp(eap)
- local fargs = api.nvim_parse_cmd('lsp ' .. eap.args, {}).args
- if not fargs then
- return
- end
- local subcmd = fargs[1]
+ local subcmd = eap.fargs[1]
if not vim.list_contains(available_subcmds, subcmd) then
echo_err(N_('E5800: Invalid :lsp subcommand: %s'):format(subcmd))
return
end
- local clients = { unpack(fargs, 2) }
-
- actions[subcmd](clients)
+ actions[subcmd]({ unpack(eap.fargs, 2) })
end
--- Completion logic for `:lsp` command
diff --git a/runtime/lua/vim/_core/swapfile.lua b/runtime/lua/vim/_core/swapfile.lua
index 7e3bee993f..12f9b56a50 100644
--- a/runtime/lua/vim/_core/swapfile.lua
+++ b/runtime/lua/vim/_core/swapfile.lua
@@ -52,7 +52,7 @@ end
--- @param items string[] List of swapfile paths.
function M.select_swap(items)
vim.ui.select(items, {
- prompt = N_('Enter number of swap file to use (q or empty cancels):'),
+ prompt = N_('Select a swapfile:'),
kind = 'swap',
format_item = format_swap,
}, function(_, idx)
diff --git a/runtime/lua/vim/_core/tag.lua b/runtime/lua/vim/_core/tag.lua
index 3c0c2f544f..82ab6d5e4f 100644
--- a/runtime/lua/vim/_core/tag.lua
+++ b/runtime/lua/vim/_core/tag.lua
@@ -30,7 +30,7 @@ function M.select_tag(eap, extra)
end
vim.ui.select(items, {
- prompt = N_('Type number and <Enter> (q or empty cancels):'),
+ prompt = N_('Select a tag:'),
kind = 'tag',
format_item = function(m)
local marker = m.cur and '>' or ' '