diff options
author | Josa Gesell <josa@gesell.me> | 2021-10-18 20:52:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 11:52:22 -0700 |
commit | e7ea54a3dfaf937021e68bc690c4d27eed9c1cca (patch) | |
tree | 7fafdfaf2601841e6dc88a3b870c3b95171524ad /runtime/lua/vim/lsp/codelens.lua | |
parent | bd2f61c6c423bd5d61ad3eca237d8a5a82925dd8 (diff) | |
download | rneovim-e7ea54a3dfaf937021e68bc690c4d27eed9c1cca.tar.gz rneovim-e7ea54a3dfaf937021e68bc690c4d27eed9c1cca.tar.bz2 rneovim-e7ea54a3dfaf937021e68bc690c4d27eed9c1cca.zip |
feat(lsp): use vim.ui.select() in codelenses (#16004)
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Mathias Fußenegger <mfussenegger@users.noreply.github.com>
Diffstat (limited to 'runtime/lua/vim/lsp/codelens.lua')
-rw-r--r-- | runtime/lua/vim/lsp/codelens.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 20b203fe99..6d3912781e 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -91,16 +91,16 @@ function M.run() local option = options[1] execute_lens(option.lens, bufnr, option.client) else - local options_strings = {"Code lenses:"} - for i, option in ipairs(options) do - table.insert(options_strings, string.format('%d. %s', i, option.lens.command.title)) - end - local choice = vim.fn.inputlist(options_strings) - if choice < 1 or choice > #options then - return - end - local option = options[choice] - execute_lens(option.lens, bufnr, option.client) + vim.ui.select(options, { + prompt = 'Code lenses:', + format_item = function(option) + return option.lens.command.title + end, + }, function(option) + if option then + execute_lens(option.lens, bufnr, option.client) + end + end) end end |