From db0682fe50d863328c7ff335486545fd71df02ae Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sun, 17 May 2026 18:34:06 +0300 Subject: feat(ui): vim.ui.input(opts.scope) #39570 Problem: There is no way for a `vim.ui.input` caller to indicate for which scope the input is. As in "This input is for something at cursor scope". This information can be useful for `vim.ui.input` implementation to tweak its behavior and presentation: - Show different floating window depending on the scope. For example: - Near cursor for "cursor" scope. - At line start for "line" scope. - In window corner for "buffer" and "window" scopes. - In whole editor corner for "tabpage", "editor", "project" scopes. - Navigate through history only for inputs with the same scope. Solution: Document new `opts.scope` for `vim.ui.input`. Use it in the codebase. --- runtime/lua/vim/lsp/buf.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/lsp/buf.lua') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index af339a6244..94fc21dd27 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -809,6 +809,7 @@ function M.rename(new_name, opts) local prompt_opts = { prompt = 'New Name: ', + scope = 'cursor', } if result.placeholder then prompt_opts.default = result.placeholder @@ -839,6 +840,7 @@ function M.rename(new_name, opts) local prompt_opts = { prompt = 'New Name: ', default = cword, + scope = 'cursor', } vim.ui.input(prompt_opts, function(input) if not input or #input == 0 then -- cgit