mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
feat(ui): add vim.ui.input and use in lsp rename (#15959)
* vim.ui.input is an overridable function that prompts for user input * take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details * defaults to a wrapper around vim.fn.input(opts) * switches the built-in client's rename handler to use vim.ui.input by default
This commit is contained in:

committed by
GitHub

parent
b74916cfd2
commit
16d4af6d2f
@@ -2435,9 +2435,9 @@ describe('LSP', function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
lsp.buf_attach_client(bufnr, TEST_RPC_CLIENT_ID)
|
||||
vim.lsp._stubs = {}
|
||||
vim.fn.input = function(prompt, text)
|
||||
vim.lsp._stubs.input_prompt = prompt
|
||||
vim.lsp._stubs.input_text = text
|
||||
vim.fn.input = function(opts, on_confirm)
|
||||
vim.lsp._stubs.input_prompt = opts.prompt
|
||||
vim.lsp._stubs.input_text = opts.default
|
||||
return 'renameto' -- expect this value in fake lsp
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, {'', 'this is line two'})
|
||||
|
Reference in New Issue
Block a user