Skip to content

Commit c2a8eb2

Browse files
committed
fix: context setting immutability
1 parent 25ad742 commit c2a8eb2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lua/opencode/context.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ local toggleable_context_keys = {
2424
local function ensure_context_state(context_key)
2525
local current_config = state.current_context_config or {}
2626
local current = current_config[context_key]
27+
local new_config = vim.deepcopy(current_config)
28+
local current = new_config[context_key]
2729
local defaults = vim.tbl_get(config, 'context', context_key) or {}
28-
current_config[context_key] = vim.tbl_deep_extend('force', {}, defaults, current or {})
29-
state.context.set_current_context_config(current_config)
30-
return current_config[context_key]
30+
31+
new_config[context_key] = vim.tbl_deep_extend('force', {}, defaults, current or {})
32+
state.context.set_current_context_config(new_config)
33+
return new_config[context_key]
3134
end
3235

3336
M.ChatContext = ChatContext

0 commit comments

Comments
 (0)