From a54716b8dd573350379588c065e4b2cc070f8d9c Mon Sep 17 00:00:00 2001 From: Uzair Aftab <48220549+Uzaaft@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:00:49 +0200 Subject: [PATCH] feat: make trouble.nvim optional (#450) --- lua/chatgpt/config.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/chatgpt/config.lua b/lua/chatgpt/config.lua index 30bc023..c986814 100644 --- a/lua/chatgpt/config.lua +++ b/lua/chatgpt/config.lua @@ -5,6 +5,14 @@ WELCOME_MESSAGE = [[ ~ Robert Half ]] +function default_quickfix_cmd() + if pcall(require("trouble")) then + return "Trouble quickfix" + else + return "cope" + end +end + local M = {} function M.defaults() local defaults = { @@ -180,7 +188,7 @@ function M.defaults() use_openai_functions_for_edits = false, ignore_default_actions_path = false, actions_paths = {}, - show_quickfixes_cmd = "Trouble quickfix", + show_quickfixes_cmd = default_quickfix_cmd(), predefined_chat_gpt_prompts = "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv", highlights = { help_key = "@symbol",