nvim-telescope / telescope-ui-select.nvim

MIT License
774 stars 18 forks source link

telescope-ui-select.nvim won't show work with null-ls + refactoring.nvim #12

Closed milanglacier closed 2 years ago

milanglacier commented 2 years ago

nvim version:

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-004.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.7.0/share/nvim"

Run :checkhealth for more info

minimal config:

local telescope = require 'telescope'

telescope.setup {
    extensions = {
        ['ui-select'] = {
            require('telescope.themes').get_dropdown {},
        },
    },
}

require('telescope').load_extension 'ui-select'

local null_ls = require 'null-ls'

null_ls.setup {

    sources = {
         null_ls.builtins.code_actions.refactoring, -- need to have refactoring.nvim installed

    }
}

vim.keymap.set('x', '<Leader>ca', vim.lsp.buf.range_code_action, {})

open a file test.py, with contents

a = 5

press V to select this line: and press <Leader>ca, select extract function, and randomly give it a name, it shows following error:

ddaE5108: Error executing lua
...pack/paqs/start/plenary.nvim/lua/plenary/async/async.lua:14:Thecoroutinefailedwiththismess
age:
..ack/paqs/opt/refactoring.nvim/lua/refactoring/region.lua:153: attempt to get length of a nil value
stack traceback:
[C]: in function 'error'
..pack/pags/start/plenary.nvim/lua/plenary/async/async.lua:14:infunction
"callback_or_next'
..pack/paqs/start/plenary.nvim/lua/plenary/async/async.lua:40:infunction
'on_confirm'
..vimView.bundle/Contents/Resources/runtime/lua/vim/ui.lua:93:in function
'input'
./paqs/opt/refactoring.nvim/lua/refactoring/get_input.lua:8:in function 'returned_function'
..pack/pags/start/plenary.nvim/lua/plenary/async/async.lua:26:infunction
'callback_or_next'
..pack/paqs/start/plenary.nvim/lua/plenary/async/async.lua:40:infunction
'step'
..pack/pags/start/plenary.nvim/lua/plenary/async/async.lua:43:infunction
"execute'
..pack/paqs/start/plenary.nvim/lua/plenary/async/async.lua:113:infunction
..s/opt/refactoring.nvim/lua/refactoring/pipeline/init.lua:70:infunction
pack/paqs/start/plenary.nvim/lua/plenary/async/async.lua:1123
..qs/opt/refactoring.nvim/lua/refactoring/refactor/106.lua:507:infunction
<...qs/opt/refactoring.nvim/lua/refactoring/refactor/106.lua:496>
.W/Cellar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp.lua:1485:in function 'fn'
..w/Cellar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp.lua:164:infunction
"for_each_buffer_client'
.w/Cellar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp.lua:1484:infunction
'requesti
.llar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp/buf.lua:645:infunction
'execute_command'
.llar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp/buf.lua:519:infunction
apply_action'
.1lar/neovim/0.7.0/share/nvim/runtime/lua/vim/lsp/buf.lua:556:infunction
'on_choice'
.e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:122:infunction'run_replace_or_original'
.ack/paqs/opt/telescope.nvim/lua/telescope/actions/mt.lua:65:in function
"key_func
./pack/paas/opt/telescope.nvim/lua/telescope/mappinas.lua:242:infunction
"execute_kevmap'

however, if we comment out this line:

-- require('telescope').load_extension 'ui-select'

then the function can be correctly extracted.

milanglacier commented 2 years ago

It seems like I messed up with some config:

I should prefix range_code_action with <C-U>