From c452fd730c94bfcbb5f9f4af1cae3c851f9456a3 Mon Sep 17 00:00:00 2001 From: Ray Wong Date: Fri, 7 Jun 2024 20:23:04 +0900 Subject: [PATCH] fix(editor): telescope init error when trouble.nvim is disabled (#3518) I got this error message when opening telescope. ``` Failed to run `config` for telescope.nvim ...l/share/nvim/lazy/LazyVim/lua/lazyvim/plugins/editor.lua:241: module 'trouble.sources.telescope' not found: ^Ino field package.preload['trouble.sources.telescope'] ... ``` After investigating it, the reason was I have `trouble.nvim` disabled but the default base `opts` function is loading it. I tried wrapping it with a function to lazy load the `trouble.nvim` module and it worked in my local setup. --- lua/lazyvim/plugins/editor.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/plugins/editor.lua b/lua/lazyvim/plugins/editor.lua index 3dc5159b..8f4891b7 100644 --- a/lua/lazyvim/plugins/editor.lua +++ b/lua/lazyvim/plugins/editor.lua @@ -240,7 +240,9 @@ return { opts = function() local actions = require("telescope.actions") - local open_with_trouble = require("trouble.sources.telescope").open + local open_with_trouble = function(...) + return require("trouble.sources.telescope").open(...) + end local find_files_no_ignore = function() local action_state = require("telescope.actions.state") local line = action_state.get_current_line()