feat: add the possibility to also add all files to initial context
This commit is contained in:
@@ -185,4 +185,22 @@ function M.get_file_contents(files, conf)
|
||||
return table.concat(sections, "\n")
|
||||
end
|
||||
|
||||
return M
|
||||
-- NEW FUNCTION: Build the project prompt by optionally including file contents.
|
||||
function M.get_project_prompt(directories, conf)
|
||||
local structure = M.get_project_structure(directories, conf)
|
||||
if conf.include_file_contents then
|
||||
local files = M.get_project_files(directories, conf)
|
||||
local contents = M.get_file_contents(files, conf)
|
||||
local total_chars = #contents
|
||||
if total_chars > conf.prompt_char_limit then
|
||||
vim.notify("Total file contents (" .. total_chars .. " characters) exceed the prompt limit (" .. conf.prompt_char_limit .. "). Please disable 'include_file_contents' in your config.", vim.log.levels.ERROR)
|
||||
return structure
|
||||
else
|
||||
return structure .. "\n" .. contents
|
||||
end
|
||||
else
|
||||
return structure
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user