Skip to content

Commit 81fd96a

Browse files
committed
fix(context): merge context config properly before sending message
1 parent ee89d25 commit 81fd96a

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
@@ -103,7 +103,10 @@ function M.send_message(prompt, opts)
103103
end
104104

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

@@ -120,10 +123,7 @@ function M.send_message(prompt, opts)
120123
state.current_mode = opts.agent
121124
end
122125

123-
state.current_context_config = opts.context
124-
context.load()
125126
params.parts = context.format_message(prompt, opts.context)
126-
127127
M.before_run(opts)
128128

129129
state.api_client

0 commit comments

Comments
 (0)