From 16d4af6d2f549709aa55510f5ae52238c5cadb9c Mon Sep 17 00:00:00 2001 From: Sebastian Lyng Johansen Date: Sun, 7 Nov 2021 16:13:53 +0100 Subject: 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 --- test/functional/plugin/lsp_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index c025e9f4ab..ae7612ab08 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -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'}) -- cgit