Skip to content

Commit 67ed258

Browse files
authored
fix(ui): do not allow empty separator (#1224)
This even working before was a miracle, the plugin is fairly reliant on separator not being empty string Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent 294bcb6 commit 67ed258

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ Below are all available configuration options with their default values:
473473
show_help = true, -- Shows help message as virtual lines when waiting for user input
474474
show_folds = true, -- Shows folds for sections in chat
475475
highlight_selection = true, -- Highlight selection
476-
highlight_headers = true, -- Highlight headers in chat, disable if using markdown renderers (like render-markdown.nvim)
476+
highlight_headers = true, -- Highlight headers in chat
477477
auto_follow_cursor = true, -- Auto-follow cursor in chat
478478
auto_insert_mode = false, -- Automatically enter insert mode when opening window and on new prompt
479479
insert_at_end = false, -- Move cursor to end of buffer when inserting text

lua/CopilotChat/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ return {
8686
show_help = true, -- Shows help message as virtual lines when waiting for user input
8787
show_folds = true, -- Shows folds for sections in chat
8888
highlight_selection = true, -- Highlight selection
89-
highlight_headers = true, -- Highlight headers in chat, disable if using markdown renderers (like render-markdown.nvim)
89+
highlight_headers = true, -- Highlight headers in chat
9090
auto_follow_cursor = true, -- Auto-follow cursor in chat
9191
auto_insert_mode = false, -- Automatically enter insert mode when opening window and on new prompt
9292
insert_at_end = false, -- Move cursor to end of buffer when inserting text

lua/CopilotChat/init.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,8 @@ end
11621162
--- Set up the plugin
11631163
---@param config CopilotChat.config.Config?
11641164
function M.setup(config)
1165-
M.config = vim.tbl_deep_extend('force', require('CopilotChat.config'), config or {})
1165+
local default_config = require('CopilotChat.config')
1166+
M.config = vim.tbl_deep_extend('force', default_config, config or {})
11661167
state.highlights_loaded = false
11671168

11681169
-- Save proxy and insecure settings
@@ -1181,6 +1182,13 @@ function M.setup(config)
11811182
M.log_level(M.config.log_level)
11821183
end
11831184

1185+
if not M.config.separator or M.config.separator == '' then
1186+
log.warn(
1187+
'Empty separator is not allowed, using default separator instead. Set `separator` in config to change this.'
1188+
)
1189+
M.config.separator = default_config.separator
1190+
end
1191+
11841192
if M.chat then
11851193
M.chat:close(state.source and state.source.bufnr or nil)
11861194
M.chat:delete()

0 commit comments

Comments
 (0)