How to lazy load neotest #455
-
Here is my current lazy config for neotest -
After adding this config, I've been seeing OCCASIONAL error on opening ANY files (non-rust files too) -
My guess is that, mason (from lsp-config) & neotest (or its dependencies) get into a race of loading themselves. Depending on who wins, I some times get errors and sometimes don't. Two questions -
TIA |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There are a few different ways to do that. I just add {
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("neotest").setup({
adapters = {
require("rustaceanvim.neotest"),
},
})
end,
+ keys = {...},
} EDIT: I've defined my keys in a separate function: https://github.com/fredrikaverpil/dotfiles/blob/fc670a75c7bd5a0349052fba3fd0183bb86a0fe1/nvim-fredrik/lua/config/keymaps.lua#L444-L535 Note that in this case you need to use anonymous functions (like I did) so that you won't load the plugin on sourcing of this code. |
Beta Was this translation helpful? Give feedback.
There are a few different ways to do that. I just add
keys
and assign my desired keymaps. This will resulting in not loading the plugin until I hit one of those keymaps.{ "nvim-neotest/neotest", dependencies = { "nvim-neotest/nvim-nio", "nvim-lua/plenary.nvim", "antoinemadec/FixCursorHold.nvim", "nvim-treesitter/nvim-treesitter", }, config = function() require("neotest").setup({ adapters = { require("rustaceanvim.neotest"), }, }) end, + keys = {...}, }
EDIT: I've defined my keys in a separate function: https://github.com/fredrikaverpil/dotfiles/blob/fc670a75c7bd5a0349052fba3fd0183bb86a0fe1/nvim-fredrik/lua/config/keymaps.lua#L444-L535
N…