diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2021-09-28 01:12:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 16:12:03 -0700 |
commit | 9ca7b6b71a1e98ff6a76270d165fc8f07763a0c3 (patch) | |
tree | 9586fce59a9169c998ddfc6a0cd47a8c44ddc5bf | |
parent | 63fde086d9e7936b21c51e145253ec69820b2112 (diff) | |
download | rneovim-9ca7b6b71a1e98ff6a76270d165fc8f07763a0c3.tar.gz rneovim-9ca7b6b71a1e98ff6a76270d165fc8f07763a0c3.tar.bz2 rneovim-9ca7b6b71a1e98ff6a76270d165fc8f07763a0c3.zip |
fix(ui): s/format_entry/format_item to match docs (#15819)
Follow up to https://github.com/neovim/neovim/pull/15771
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/ui.lua | 4 | ||||
-rw-r--r-- | test/functional/lua/ui_spec.lua | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 538bd2605b..def83a7320 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -149,7 +149,7 @@ M['textDocument/codeAction'] = function(_, result, ctx) vim.ui.select(result, { prompt = 'Code actions:', - format_entry = function(action) + format_item = function(action) local title = action.title:gsub('\r\n', '\\r\\n') return title:gsub('\n', '\\n') end, diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua index aebb63d56f..5eab20fc54 100644 --- a/runtime/lua/vim/ui.lua +++ b/runtime/lua/vim/ui.lua @@ -20,9 +20,9 @@ function M.select(items, opts, on_choice) } opts = opts or {} local choices = {opts.prompt or 'Select one of:'} - local format_entry = opts.format_entry or tostring + local format_item = opts.format_item or tostring for i, item in pairs(items) do - table.insert(choices, string.format('%d: %s', i, format_entry(item))) + table.insert(choices, string.format('%d: %s', i, format_item(item))) end local choice = vim.fn.inputlist(choices) if choice < 1 or choice > #items then diff --git a/test/functional/lua/ui_spec.lua b/test/functional/lua/ui_spec.lua index 25a208b70b..94f1b5840b 100644 --- a/test/functional/lua/ui_spec.lua +++ b/test/functional/lua/ui_spec.lua @@ -17,7 +17,7 @@ describe('vim.ui', function() { name = 'Item 2' }, } local opts = { - format_entry = function(entry) + format_item = function(entry) return entry.name end } |