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

Neotest watch toggle fails with LazyVim #460

Open
rbhanot4739 opened this issue Oct 1, 2024 · 2 comments
Open

Neotest watch toggle fails with LazyVim #460

rbhanot4739 opened this issue Oct 1, 2024 · 2 comments
Assignees

Comments

@rbhanot4739
Copy link

NeoVim Version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1725453128

Describe the bug
I am running LazyVim with python and test extra and for some reason running the Neotest watch toggle and looking for neotest help pages breaks for me. When I run require("neotest").watch.toggle(vim.fn.expand("%")) via <leader>tw I get the following error trace

E5108: Error executing lua: ...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:100: Async task failed without callback: The coroutine failed with this message: 
...e/nvim/lazy/neotest/lua/neotest/consumers/watch/init.lua:36: attempt to call field 'supports_method' (a table value)
stack traceback:
	...e/nvim/lazy/neotest/lua/neotest/consumers/watch/init.lua: in function 'get_valid_client'
	...e/nvim/lazy/neotest/lua/neotest/consumers/watch/init.lua:51: in function 'get_lsp_client'
	...e/nvim/lazy/neotest/lua/neotest/consumers/watch/init.lua:110: in function 'watch'
	...e/nvim/lazy/neotest/lua/neotest/consumers/watch/init.lua:160: in function 'func'
	...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:173: in function <...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:172>
stack traceback:
	[C]: in function 'error'
	...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:100: in function 'close_task'
	...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:122: in function 'step'
	...bhanot/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:150: in function 'toggle'
	...im/lazy/LazyVim/lua/lazyvim/plugins/extras/test/core.lua:117: in function <...im/lazy/LazyVim/lua/lazyvim/plugins/extras/test/core.lua:117>

To Reproduce

  1. Load LazyVim with above config and open a python file.
  2. Press <leader>tw or run =require("neotest").watch.toggle(vim.fn.expand("%")) to toggle test watch.
nvim --clean -u minimal.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({

  spec = {
    -- add LazyVim and import its plugins
    {
      "LazyVim/LazyVim",
      import = "lazyvim.plugins",
    },
    { import = "lazyvim.plugins.extras.test.core" },
    { import = "lazyvim.plugins.extras.dap.core" },
    { import = "lazyvim.plugins.extras.lang.python" },
    { import = "plugins.neotest" },
  },
})

Contents of lua/plugins/neotest.lua

return {
  "nvim-neotest/neotest",
  keys = {
    {
      "<leader>tT",
      function()
        require("neotest").run.run(LazyVim.root())
      end,
      desc = "Run All Test Files",
    },
  },

  opts = {
    adapters = {
      ["neotest-python"] = {
        dap = { justMyCode = true },
        pytest_discover_instances = true,
      },
    },
  },
}
@rbhanot4739 rbhanot4739 changed the title [BUG] [BUG] Neotest watch toggle fails with LazyVim Oct 1, 2024
@rbhanot4739 rbhanot4739 changed the title [BUG] Neotest watch toggle fails with LazyVim Neotest watch toggle fails with LazyVim Oct 1, 2024
@fredrikaverpil
Copy link
Contributor

Please see #456

@rbhanot4739
Copy link
Author

Any ETA on when this would be merged ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants