-
-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathconfig.lua
More file actions
140 lines (120 loc) · 6.37 KB
/
config.lua
File metadata and controls
140 lines (120 loc) · 6.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---@alias CopilotChat.config.Layout 'vertical'|'horizontal'|'float'|'replace'
---@class CopilotChat.config.Window
---@field layout? CopilotChat.config.Layout|fun():CopilotChat.config.Layout
---@field relative 'editor'|'win'|'cursor'|'mouse'?
---@field border 'none'|'single'|'double'|'rounded'|'solid'|'shadow'?
---@field width number?
---@field height number?
---@field row number?
---@field col number?
---@field title string?
---@field footer string?
---@field zindex number?
---@field blend number?
---@class CopilotChat.config.Shared
---@field system_prompt nil|string
---@field model string?
---@field tools string|table<string>|nil
---@field resources string|table<string>|nil
---@field sticky string|table<string>|nil
---@field diff 'block'|'unified'?
---@field language string?
---@field temperature number?
---@field headless boolean?
---@field callback nil|fun(response: CopilotChat.client.Message, source: CopilotChat.ui.chat.Source)
---@field remember_as_sticky boolean?
---@field window CopilotChat.config.Window?
---@field show_help boolean?
---@field show_folds boolean?
---@field highlight_selection boolean?
---@field highlight_headers boolean?
---@field auto_follow_cursor boolean?
---@field auto_insert_mode boolean?
---@field auto_fold boolean?
---@field insert_at_end boolean?
---@field clear_chat_on_new_prompt boolean?
---@field stop_on_function_failure boolean?
--- CopilotChat default configuration
---@class CopilotChat.config.Config : CopilotChat.config.Shared
---@field debug boolean?
---@field log_level 'trace'|'debug'|'info'|'warn'|'error'|'fatal'?
---@field proxy string?
---@field allow_insecure boolean?
---@field instruction_files table<int, string>?
---@field selection 'visual'|'unnamed'|nil
---@field chat_autocomplete boolean?
---@field log_path string?
---@field history_path string?
---@field headers table<string, string>?
---@field separator string?
---@field providers table<string, CopilotChat.config.providers.Provider>?
---@field functions table<string, CopilotChat.config.functions.Function>?
---@field prompts table<string, CopilotChat.config.prompts.Prompt|string>?
---@field mappings CopilotChat.config.mappings?
return {
-- Shared config starts here (can be passed to functions at runtime and configured via setup function)
system_prompt = require('CopilotChat.config.prompts').COPILOT_INSTRUCTIONS.system_prompt, -- System prompt to use (can be specified manually in prompt via /).
model = 'gpt-4.1', -- Default model to use, see ':CopilotChatModels' for available models (can be specified manually in prompt via $).
tools = nil, -- Default tool or array of tools (or groups) to share with LLM (can be specified manually in prompt via @).
resources = 'selection', -- Default resources to share with LLM (can be specified manually in prompt via #).
sticky = nil, -- Default sticky prompt or array of sticky prompts to use at start of every new chat (can be specified manually in prompt via >).
diff = 'block', -- Default diff format to use, 'block' or 'unified'.
language = 'English', -- Default language to use for answers
temperature = 0.1, -- Result temperature
headless = false, -- Do not write to chat buffer and use history (useful for using custom processing)
callback = nil, -- Function called when full response is received
remember_as_sticky = true, -- Remember config as sticky prompts when asking questions
-- default window options
window = {
layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace', or a function that returns the layout
width = 0.5, -- fractional width of parent, or absolute width in columns when > 1
height = 0.5, -- fractional height of parent, or absolute height in rows when > 1
-- Options below only apply to floating windows
relative = 'editor', -- 'editor', 'win', 'cursor', 'mouse'
border = 'single', -- 'none', single', 'double', 'rounded', 'solid', 'shadow'
row = nil, -- row position of the window, default is centered
col = nil, -- column position of the window, default is centered
title = 'Copilot Chat', -- title of chat window
footer = nil, -- footer of chat window
zindex = 1, -- determines if window is on top or below other floating windows
blend = 0, -- window blend (transparency), 0-100, 0 is opaque, 100 is fully transparent
},
show_help = true, -- Shows help message as virtual lines when waiting for user input
show_folds = true, -- Shows folds for sections in chat
auto_fold = false, -- Automatically non-assistant messages in chat (requires 'show_folds' to be true)
highlight_selection = true, -- Highlight selection
highlight_headers = true, -- Highlight headers in chat
auto_follow_cursor = true, -- Auto-follow cursor in chat
auto_insert_mode = false, -- Automatically enter insert mode when opening window and on new prompt
insert_at_end = false, -- Move cursor to end of buffer when inserting text
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
stop_on_function_failure = false, -- Stop processing prompt if any function fails (preserves quota)
-- Static config starts here (can be configured only via setup function)
debug = false, -- Enable debug logging (same as 'log_level = 'debug')
log_level = 'info', -- Log level to use, 'trace', 'debug', 'info', 'warn', 'error', 'fatal'
proxy = nil, -- [protocol://]host[:port] Use this proxy
allow_insecure = false, -- Allow insecure server connections
-- Instruction files to look for in current working directory
instruction_files = {
'.github/copilot-instructions.md',
'AGENTS.md',
},
selection = 'visual', -- Selection source
chat_autocomplete = true, -- Enable chat autocompletion (when disabled, requires manual `mappings.complete` trigger)
log_path = vim.fn.stdpath('state') .. '/CopilotChat.log', -- Default path to log file
history_path = vim.fn.stdpath('data') .. '/copilotchat_history', -- Default path to stored history
headers = {
user = 'User', -- Header to use for user questions
assistant = 'Copilot', -- Header to use for AI answers
tool = 'Tool', -- Header to use for tool calls
},
separator = '───', -- Separator to use in chat
-- default providers
providers = require('CopilotChat.config.providers'),
-- default functions
functions = require('CopilotChat.config.functions'),
-- default prompts
prompts = require('CopilotChat.config.prompts'),
-- default mappings
mappings = require('CopilotChat.config.mappings'),
}