Skip to content

Commit 93a8964

Browse files
committed
Load chat auto_insert from config instead of passing it in contructor
This means it can be properly overriden when opening chat and also follows same loading as other chat configuration already does Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent 9ea6718 commit 93a8964

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lua/CopilotChat/chat.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ function CopilotChatFoldExpr(lnum, separator)
3030
return '='
3131
end
3232

33-
local Chat = class(function(self, help, auto_insert, on_buf_create)
33+
local Chat = class(function(self, help, on_buf_create)
3434
self.header_ns = vim.api.nvim_create_namespace('copilot-chat-headers')
3535
self.help = help
36-
self.auto_insert = auto_insert
3736
self.on_buf_create = on_buf_create
3837
self.bufnr = nil
3938
self.winnr = nil
4039
self.spinner = nil
4140
self.separator = nil
41+
self.auto_insert = false
4242
self.auto_follow_cursor = true
4343
self.highlight_headers = true
4444
self.layout = nil
@@ -220,6 +220,7 @@ function Chat:open(config)
220220

221221
self.layout = layout
222222
self.separator = config.separator
223+
self.auto_insert = config.auto_insert
223224
self.auto_follow_cursor = config.auto_follow_cursor
224225
self.highlight_headers = config.highlight_headers
225226

lua/CopilotChat/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ function M.setup(config)
873873
end
874874
state.chat = Chat(
875875
M.config.show_help and key_to_info('show_help', M.config.mappings.show_help),
876-
M.config.auto_insert_mode,
877876
function(bufnr)
878877
map_key(M.config.mappings.show_help, bufnr, function()
879878
local chat_help = '**`Special tokens`**\n'

0 commit comments

Comments
 (0)