stevearc / dressing.nvim

Neovim plugin to improve the default vim.ui interfaces
MIT License
1.69k stars 32 forks source link

code_actions broken on nvim nightly #126

Closed svampkorg closed 8 months ago

svampkorg commented 8 months ago

Describe the bug Dressing overrides the built in vim.ui.select function and I believe using code_actions with this overridden selector got broken after these changes in nightly nvim: https://github.com/neovim/neovim/commit/9281edb334a374e7753d4a6b7a05e31120e39772

I now get this, when opening up code-actions: Error executing vim.schedule lua callback: ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:28: attempt to index a nil value stack traceback: ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:28: in function <...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:8> ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:132: in function 'select' ...are/nvim/lazy/dressing.nvim/lua/dressing/select/init.lua:70: in function 'fn' vim/_editor.lua:343: in function <vim/_editor.lua:342>

If I use Telescope extension ui-select I get this: Error executing vim.schedule lua callback: ...e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:35: attempt to index a nil value stack traceback: ...e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:35: in function <...e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:23> ...e-ui-select.nvim/lua/telescope/_extensions/ui-select.lua:96: in function 'select' ...ovim/HEAD-f1e9aa8/share/nvim/runtime/lua/vim/lsp/buf.lua:720: in function 'on_code_action_results' ...ovim/HEAD-f1e9aa8/share/nvim/runtime/lua/vim/lsp/buf.lua:789: in function 'handler' ...r/neovim/HEAD-f1e9aa8/share/nvim/runtime/lua/vim/lsp.lua:1516: in function 'fn' vim/_editor.lua:343: in function <vim/_editor.lua:342>

Not sure if to report issue here or at telescope-ui-select.. or both!

System information

-- Paste your call to require("dressing").setup(...) in here

To Reproduce Steps to reproduce the behavior:

  1. Build and run Neovim nightly
  2. Open any code file for which an lsp-server is attached
  3. Attempt to open a code-action menu. (make sure there's one available :) )
  4. Error executing vim.schedule lua callback: ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:28: attempt to index a nil value

If possible, provide a minimal file that will trigger the issue (see tests/manual for examples of short ways to call vim.ui.*):

local hello = function() end

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I borrowed some code from the creator of all those mini-plugins, namely the mini.pick plugin - pick.lua in his repo https://github.com/echasnovski/mini.nvim/tree/main - and used his ui_select to override vim.ui.select, and it works without this error I get with either dressing or telescope-ui-select extension. Not sure what the difference is. I'm not that fluent in Lua :)

garymjr commented 8 months ago

I ran into this too and did some digging. If you change line 27 in lua/dressing/select/telescope.lua from local client_id = item[1] to local client_id = item.ctx.client_id code actions work correctly again. Looking through neovim commits I'm assuming 9281edb is what broke it.

svampkorg commented 8 months ago

I ran into this too and did some digging. If you change line 27 in lua/dressing/select/telescope.lua from local client_id = item[1] to local client_id = item.ctx.client_id code actions work correctly again. Looking through neovim commits I'm assuming 9281edb is what broke it.

LTDR: It worked! 👍

Awesome find! I struggled a bit with Lazy plugin manager, trying to use the dev parameter to point to a version of dressing I had cloned locally. It worked, partly. For whatever reason Lazy could not find the branch I had created. Probably because it wasn't pushed to remote and I didn't want to do that just yet, so I cloned dressing instead =P But I can now confirm that doing the changes you suggested works!

stevearc commented 8 months ago

Should be fixed!

radvil commented 8 months ago

is it me, or its breaking on my config now after this commit ?? NVIM v0.10.0-dev-4eea609

radvil commented 8 months ago

I updated neovim to NVIM v0.10.0-dev-a935c75 now fixed it

vonPB commented 6 months ago

I am on the latest neovim nightly NVIM v0.10.0-dev-1138+g71d9b7d15. This fix didnt seem to work for me, rather it was the problem. Removing the version check again fixed the issue for me... https://github.com/stevearc/dressing.nvim/blob/fe3071330a0720ce3695ac915820c8134b22d1b0/lua/dressing/select/telescope.lua#L28

dkarter commented 6 months ago

I have NVIM v0.10.0-dev-1420+g9dc440400-Homebrew and dressing.nvim commit 94b0d24 And running :lua print(vim.fn.has("nvim-0.10")) evaluates to 1 but I still see this error:

   Error  00:51:24 msg_show.lua_error Error executing vim.schedule lua callback: ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:29: attempt to index field 'ctx' (a nil value)
stack traceback:
    ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:29: in function <...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:8>
    ...vim/lazy/dressing.nvim/lua/dressing/select/telescope.lua:137: in function 'select'
    ...are/nvim/lazy/dressing.nvim/lua/dressing/select/init.lua:70: in function 'fn'
    vim/_editor.lua:342: in function <vim/_editor.lua:341>

CleanShot 2024-01-01 at 00 53 16@2x

https://github.com/stevearc/dressing.nvim/assets/551858/c6e9b151-90cd-4217-b721-4628f7fde444

CleanShot 2024-01-01 at 00 53 33@2x