Skip to content

Commit af37178

Browse files
committed
fix(context): merge context config properly before sending message
1 parent ee5e312 commit af37178

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lua/opencode/context.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function M.get_diagnostics(buf)
7272
end
7373

7474
local current_conf = vim.tbl_get(state, 'current_context_config', 'diagnostics') or {}
75+
if current_conf.enabled == false then
76+
return {}
77+
end
78+
7579
local global_conf = vim.tbl_get(config, 'context', 'diagnostics') or {}
7680
local diagnostic_conf = vim.tbl_deep_extend('force', global_conf, current_conf) or {}
7781

lua/opencode/core.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ function M.send_message(prompt, opts)
104104
end
105105

106106
opts = opts or {}
107-
opts.context = opts.context or config.context
107+
108+
opts.context = vim.tbl_deep_extend('force', state.current_context_config or {}, opts.context or {})
109+
state.current_context_config = opts.context
110+
context.load()
108111
opts.model = opts.model or state.current_model
109112
opts.agent = opts.agent or state.current_mode or config.default_mode
110113

@@ -121,10 +124,7 @@ function M.send_message(prompt, opts)
121124
state.current_mode = opts.agent
122125
end
123126

124-
state.current_context_config = opts.context
125-
context.load()
126127
params.parts = context.format_message(prompt, opts.context)
127-
128128
M.before_run(opts)
129129

130130
state.api_client

0 commit comments

Comments
 (0)