Closed bbiao closed 1 year ago
I do dome debugging for the above problem, and found when the message shown, the lua backtrace is
stack traceback:
^I[string "..."]: in function <[string "..."]:0>
^I[C]: in function 'pcall'
^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:50: in function 'loader_apply_config'
^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:153: in function <...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:126>
^I[C]: in function 'pcall'
^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:176: in function <...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:175>
^I...ai/.config/nvim-beginner/nvim/plugin/packer_compiled.lua:1474: in function <...ai/.config/nvim-beginner/nvim/plugin/packer_compiled.lua:1463>
^I[C]: in function 'require'
^I...k/packer/opt/trouble.nvim/lua/trouble/providers/init.lua:3: in main chunk
^I[C]: in function 'require'
^I...te/pack/packer/opt/trouble.nvim/lua/trouble/renderer.lua:1: in main chunk
^I[C]: in function 'require'
^I...m/site/pack/packer/opt/trouble.nvim/lua/trouble/view.lua:1: in main chunk
^I[C]: in function 'require'
^I...m/site/pack/packer/opt/trouble.nvim/lua/trouble/init.lua:1: in main chunk
^I[C]: at 0xffff9cd10f20
^I[C]: in function 'pcall'
^I...te/pack/packer/opt/gitsigns.nvim/lua/gitsigns/config.lua:765: in function 'resolve_default'
^I...te/pack/packer/opt/gitsigns.nvim/lua/gitsigns/config.lua:958: in function 'build'
^I...nvim/site/pack/packer/opt/gitsigns.nvim/lua/gitsigns.lua:168: in function <...nvim/site/pack/packer/opt/gitsigns.nvim/lua/gitsigns.lua:167>
The problem is that ^I...k/packer/opt/trouble.nvim/lua/trouble/providers/init.lua:3: in main chunk
load itself. And I checked the code in lua/plugins.lua, found:
use {
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble" },
module = { "trouble.providers.telescope" },
config = function()
require("trouble").setup {
use_diagnostic_signs = true,
}
end,
}
The plugin declare a module "trouble.providers.telescope" to load which is defined in itself. After remove this line, all works as desired.
I do dome debugging for the above problem, and found when the message shown, the lua backtrace is
stack traceback: ^I[string "..."]: in function <[string "..."]:0> ^I[C]: in function 'pcall' ^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:50: in function 'loader_apply_config' ^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:153: in function <...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:126> ^I[C]: in function 'pcall' ^I...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:176: in function <...m/site/pack/packer/start/packer.nvim/lua/packer/load.lua:175> ^I...ai/.config/nvim-beginner/nvim/plugin/packer_compiled.lua:1474: in function <...ai/.config/nvim-beginner/nvim/plugin/packer_compiled.lua:1463> ^I[C]: in function 'require' ^I...k/packer/opt/trouble.nvim/lua/trouble/providers/init.lua:3: in main chunk ^I[C]: in function 'require' ^I...te/pack/packer/opt/trouble.nvim/lua/trouble/renderer.lua:1: in main chunk ^I[C]: in function 'require' ^I...m/site/pack/packer/opt/trouble.nvim/lua/trouble/view.lua:1: in main chunk ^I[C]: in function 'require' ^I...m/site/pack/packer/opt/trouble.nvim/lua/trouble/init.lua:1: in main chunk ^I[C]: at 0xffff9cd10f20 ^I[C]: in function 'pcall' ^I...te/pack/packer/opt/gitsigns.nvim/lua/gitsigns/config.lua:765: in function 'resolve_default' ^I...te/pack/packer/opt/gitsigns.nvim/lua/gitsigns/config.lua:958: in function 'build' ^I...nvim/site/pack/packer/opt/gitsigns.nvim/lua/gitsigns.lua:168: in function <...nvim/site/pack/packer/opt/gitsigns.nvim/lua/gitsigns.lua:167>
The problem is that
^I...k/packer/opt/trouble.nvim/lua/trouble/providers/init.lua:3: in main chunk
load itself. And I checked the code in lua/plugins.lua, found:use { "folke/trouble.nvim", cmd = { "TroubleToggle", "Trouble" }, module = { "trouble.providers.telescope" }, config = function() require("trouble").setup { use_diagnostic_signs = true, } end, }
The plugin declare a module "trouble.providers.telescope" to load which is defined in itself. After remove this line, all works as desired.
After dig more into the source file, I found that it is because the impatient.nvim
cached the lua import path, and the gitsigns.lua can load trouble.lua directly from disk without the packer.nvim's custom lua loader. But when trouble.lua init iteself, it requires trouble.providers.telescope
matches its own module config.
add the following code will fix this
_G.__luacache_config = { modpaths = { enable = false } }
When I use nvb to start nvim, the error message shown on the left corner.
packer.nvim: Error running config for trouble.nvim: [string "….."]:0: loop or previous error loading module 'trouble'