@@ -74,18 +74,7 @@ local utils = require('CopilotChat.utils')
7474--- @field agent string ?
7575--- @field context string | table<string> | nil
7676--- @field temperature number ?
77- --- @field question_header string ?
78- --- @field answer_header string ?
79- --- @field error_header string ?
80- --- @field separator string ?
81- --- @field show_folds boolean ?
82- --- @field show_help boolean ?
83- --- @field auto_follow_cursor boolean ?
84- --- @field auto_insert_mode boolean ?
85- --- @field clear_chat_on_new_prompt boolean ?
86- --- @field highlight_selection boolean ?
87- --- @field highlight_headers boolean ?
88- --- @field no_chat boolean ?
77+ --- @field headless boolean ?
8978--- @field callback fun ( response : string , source : CopilotChat.config.source )?
9079--- @field selection nil | fun ( source : CopilotChat.config.source ): CopilotChat.config.selection ?
9180--- @field window CopilotChat.config.window ?
@@ -96,40 +85,34 @@ local utils = require('CopilotChat.utils')
9685--- @field log_level string ?
9786--- @field proxy string ?
9887--- @field allow_insecure boolean ?
99- --- @field chat_autocomplete boolean ?
10088--- @field history_path string ?
89+ --- @field question_header string ?
90+ --- @field answer_header string ?
91+ --- @field error_header string ?
92+ --- @field separator string ?
93+ --- @field show_folds boolean ?
94+ --- @field show_help boolean ?
95+ --- @field highlight_selection boolean ?
96+ --- @field highlight_headers boolean ?
97+ --- @field chat_autocomplete boolean ?
98+ --- @field auto_follow_cursor boolean ?
99+ --- @field auto_insert_mode boolean ?
100+ --- @field insert_at_end boolean ?
101+ --- @field clear_chat_on_new_prompt boolean ?
101102--- @field contexts table<string , CopilotChat.config.context> ?
102103--- @field prompts table<string , CopilotChat.config.prompt | string> ?
103104--- @field mappings CopilotChat.config.mappings ?
104105return {
105- debug = false , -- Enable debug logging (same as 'log_level = 'debug')
106- log_level = ' info' , -- Log level to use, 'trace', 'debug', 'info', 'warn', 'error', 'fatal'
107- proxy = nil , -- [protocol://]host[:port] Use this proxy
108- allow_insecure = false , -- Allow insecure server connections
106+
107+ -- Shared config starts here (can be passed to functions at runtime)
109108
110109 system_prompt = prompts .COPILOT_INSTRUCTIONS , -- System prompt to use (can be specified manually in prompt via /).
111110 model = ' gpt-4o' , -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
112111 agent = ' copilot' , -- Default agent to use, see ':CopilotChatAgents' for available agents (can be specified manually in prompt via @).
113112 context = nil , -- Default context or array of contexts to use (can be specified manually in prompt via #).
114113 temperature = 0.1 , -- GPT result temperature
115114
116- question_header = ' ## User ' , -- Header to use for user questions
117- answer_header = ' ## Copilot ' , -- Header to use for AI answers
118- error_header = ' ## Error ' , -- Header to use for errors
119- separator = ' ───' , -- Separator to use in chat
120-
121- chat_autocomplete = true , -- Enable chat autocompletion (when disabled, requires manual `mappings.complete` trigger)
122- show_folds = true , -- Shows folds for sections in chat
123- show_help = true , -- Shows help message as virtual lines when waiting for user input
124- auto_follow_cursor = true , -- Auto-follow cursor in chat
125- auto_insert_mode = false , -- Automatically enter insert mode when opening window and on new prompt
126- insert_at_end = false , -- Move cursor to end of buffer when inserting text
127- clear_chat_on_new_prompt = false , -- Clears chat on every new prompt
128- highlight_selection = true , -- Highlight selection
129- highlight_headers = true , -- Highlight headers in chat, disable if using markdown renderers (like render-markdown.nvim)
130-
131- history_path = vim .fn .stdpath (' data' ) .. ' /copilotchat_history' , -- Default path to stored history
132- no_chat = false , -- Do not write to chat buffer and use history(useful for using callback for custom processing)
115+ headless = false , -- Do not write to chat buffer and use history(useful for using callback for custom processing)
133116 callback = nil , -- Callback to use when ask response is received
134117
135118 -- default selection
@@ -152,6 +135,30 @@ return {
152135 zindex = 1 , -- determines if window is on top or below other floating windows
153136 },
154137
138+ -- Static config starts here (can be configured only via setup function)
139+
140+ debug = false , -- Enable debug logging (same as 'log_level = 'debug')
141+ log_level = ' info' , -- Log level to use, 'trace', 'debug', 'info', 'warn', 'error', 'fatal'
142+ proxy = nil , -- [protocol://]host[:port] Use this proxy
143+ allow_insecure = false , -- Allow insecure server connections
144+ history_path = vim .fn .stdpath (' data' ) .. ' /copilotchat_history' , -- Default path to stored history
145+
146+ question_header = ' ## User ' , -- Header to use for user questions
147+ answer_header = ' ## Copilot ' , -- Header to use for AI answers
148+ error_header = ' ## Error ' , -- Header to use for errors
149+ separator = ' ───' , -- Separator to use in chat
150+
151+ show_folds = true , -- Shows folds for sections in chat
152+ show_help = true , -- Shows help message as virtual lines when waiting for user input
153+ highlight_selection = true , -- Highlight selection
154+ highlight_headers = true , -- Highlight headers in chat, disable if using markdown renderers (like render-markdown.nvim)
155+
156+ chat_autocomplete = true , -- Enable chat autocompletion (when disabled, requires manual `mappings.complete` trigger)
157+ auto_follow_cursor = true , -- Auto-follow cursor in chat
158+ auto_insert_mode = false , -- Automatically enter insert mode when opening window and on new prompt
159+ insert_at_end = false , -- Move cursor to end of buffer when inserting text
160+ clear_chat_on_new_prompt = false , -- Clears chat on every new prompt
161+
155162 -- default contexts
156163 contexts = {
157164 buffer = {
0 commit comments