feat: add debug logging

This commit is contained in:
2024-12-14 12:48:16 +01:00
parent 314a65a203
commit e97aa81d8f
5 changed files with 104 additions and 52 deletions

View File

@@ -1,11 +1,3 @@
-- lua/chatgpt_nvim/config.lua
-- Modified to:
-- 1) Determine the Git root based on the currently opened file.
-- 2) If no file is open or not in Git repo, fallback to current working directory.
-- 3) Add support for configuring a list of default prompt blocks ("go-development", "typo3-development", "basic-prompt") that can override the initial prompt if provided.
-- 4) Add support for configuring a token limit.
-- 5) Load a project_name from the .chatgpt_config.yaml for project verification.
local M = {}
local uv = vim.loop
@@ -61,7 +53,8 @@ function M.load()
directories = { "." },
default_prompt_blocks = {},
token_limit = 128000,
project_name = ""
project_name = "",
debug = false
}
if fd then
@@ -86,6 +79,9 @@ function M.load()
if type(result.project_name) == "string" then
config.project_name = result.project_name
end
if type(result.debug) == "boolean" then
config.debug = result.debug
end
end
end
else
@@ -106,6 +102,11 @@ function M.load()
end
end
if config.debug then
vim.api.nvim_out_write("[chatgpt_nvim:config] Loaded config from: " .. path .. "\n")
vim.api.nvim_out_write("[chatgpt_nvim:config] Debug logging is enabled.\n")
end
return config
end