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

[BUG] watch.toggle broke in update #457

Open
whytewolf opened this issue Sep 24, 2024 · 2 comments
Open

[BUG] watch.toggle broke in update #457

whytewolf opened this issue Sep 24, 2024 · 2 comments
Assignees

Comments

@whytewolf
Copy link

NeoVim Version

NVIM v0.10.1
Build type: RelWithDebInfo
LuaJIT 2.1.1725453128
Run "nvim -V1 -v" for more info

Describe the bug
require("neotest").watch.toggle(vim.fn.expand("%")) is throwing a strack trace after an update

E5108: Error executing lua: ...tewolf/.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'
	...tewolf/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:173: in function <...tewolf/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:172>
stack traceback:
	[C]: in function 'error'
	...tewolf/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:100: in function 'close_task'
	...tewolf/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:122: in function 'step'
	...tewolf/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:150: in function 'toggle'
	/home/whytewolf/.config/nvim/lua/ww/plugins/neotest.lua:88: in function </home/whytewolf/.config/nvim/lua/ww/plugins/neotest.lua:87>

To Reproduce
Please provide a minimal init.lua to reproduce which can be run as the following:

nvim --clean -u minimal.lua

You can edit the following example file to include your adapters and other required setup.

vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))

local lazypath = "/tmp/lazy/lazy.nvim"

if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end

vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  "nvim-neotest/neotest",
  dependencies = {
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "antoinemadec/FixCursorHold.nvim",
    "nvim-treesitter/nvim-treesitter",
    "nvim-neotest/neotest-python",
    "nvim-neotest/neotest-plenary",
    "nvim-neotest/neotest-vim-test",
  },
  config = function()
    require("neotest").setup({
      adapters = {
        require("neotest-python")({
          dap = { justMyCode = false },
          args = { "--cov=src", "--log-level", "DEBUG" },
          runner = "pytest",
      }),
        require("neotest-plenary"),
        require("neotest-vim-test")({
          ignore_file_types = { "python", "vim", "lua" },
        }),
      },
    })
  end,
})

Steps to reproduce the behavior:

  1. load a test file
  2. :lua require("neotest").watch.toggle(vim.fn.expand("%"))
    a. nothing happens, no sidebar nothing
  3. :lua require("neotest").watch.toggle(vim.fn.expand("%")) again
  4. get error.

Please provide example test files to reproduce.

Expected behavior
watch sidebar pops up showing tests.

Additional context
this setup was working last week. and no other changes have taken place besides an update.

@whytewolf
Copy link
Author

ok, I was thinking of a different functionality... but this did have the error.

#456 does look like it fixes the error seen.

@rcasia
Copy link
Contributor

rcasia commented Oct 13, 2024

This issue is solved as #456 is already 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