Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code_actions broken on nvim nightly #126

Closed
svampkorg opened this issue Nov 6, 2023 · 7 comments
Closed

code_actions broken on nvim nightly #126

svampkorg opened this issue Nov 6, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@svampkorg
Copy link

svampkorg commented Nov 6, 2023

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: neovim/neovim@9281edb

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

  • OS:
    Mac
  • Neovim version:
    NVIM v0.10.0-dev-1482+gf1e9aa8f7-Homebrew
    Build type: Release
    LuaJIT 2.1.1697887905
  • Is this related to a specific vim.ui.select backend? If so, which one?
    vim.ui.select, applied to code_actions from lisp
  • Dressing config:
    default
-- 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 :)

@svampkorg svampkorg added the bug Something isn't working label Nov 6, 2023
@garymjr
Copy link

garymjr commented Nov 6, 2023

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
Copy link
Author

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!

cleong14 added a commit to cleong14/dressing.nvim that referenced this issue Nov 7, 2023
Signed-off-by: Chaz Leong <13462818+cleong14@users.noreply.github.com>
@stevearc
Copy link
Owner

stevearc commented Nov 7, 2023

Should be fixed!

@radvil
Copy link

radvil commented Nov 7, 2023

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

@radvil
Copy link

radvil commented Nov 7, 2023

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

@vonPB
Copy link

vonPB commented Dec 16, 2023

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...

if vim.fn.has("nvim-0.10") == 1 then

@dkarter
Copy link

dkarter commented Jan 1, 2024

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

CleanShot.2024-01-01.at.00.51.19.mp4

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants