Skip to content

Commit 96dd3bc

Browse files
committed
fix(context-completion): remove agent/files
The remove agents/files was referring to the old keymap structure
1 parent c321604 commit 96dd3bc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

lua/opencode/context.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function M.load()
5151
state.context_updated_at = vim.uv.now()
5252
end
5353

54+
-- Checks if a context feature is enabled in config or state
55+
---@param context_key string
56+
---@return boolean
5457
function M.is_context_enabled(context_key)
5558
local is_enabled = vim.tbl_get(config, 'context', context_key, 'enabled')
5659
local is_state_enabled = vim.tbl_get(state, 'current_context_config', context_key, 'enabled')
@@ -177,6 +180,7 @@ function M.clear_subagents()
177180
end
178181

179182
---@param opts? OpencodeContextConfig
183+
---@return OpencodeContext
180184
function M.delta_context(opts)
181185
opts = opts or config.context
182186
if opts.enabled == false then

lua/opencode/ui/completion/context.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ local function format_selections(selections)
6464
end
6565

6666
---@param cursor_data OpencodeContextCursorData
67+
---@return string
6768
local function format_cursor_data(cursor_data)
6869
if context.is_context_enabled('cursor_data') == false then
6970
return 'Enable cursor data context.'
@@ -114,7 +115,7 @@ local context_source = {
114115
local filename = vim.fn.fnamemodify(file, ':~:.')
115116
table.insert(
116117
items,
117-
create_context_item(filename, 'mentioned_file', true, 'Remove ' .. filename, icons.get_glyph('file'))
118+
create_context_item(filename, 'mentioned_file', true, 'Select to remove file ' .. filename, icons.get('file'))
118119
)
119120
end
120121
end
@@ -133,7 +134,13 @@ local context_source = {
133134
for _, subagent in ipairs(ctx.mentioned_subagents) do
134135
table.insert(
135136
items,
136-
create_context_item(subagent .. ' (agent)', 'subagent', true, 'Remove ' .. subagent, icons.get_glyph('agent'))
137+
create_context_item(
138+
subagent .. ' (agent)',
139+
'subagent',
140+
true,
141+
'Select to remove agent ' .. subagent,
142+
icons.get('agent')
143+
)
137144
)
138145
end
139146
end

lua/opencode/ui/input_window.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ function M.remove_mention(mention_name, windows)
216216

217217
local lines = vim.api.nvim_buf_get_lines(windows.input_buf, 0, -1, false)
218218
for i, line in ipairs(lines) do
219-
local updated_line = line:gsub(config.keymap.window.mention .. mention_name, '')
219+
local mention_key = config.get_key_for_function('input_window', 'mention')
220+
local updated_line = line:gsub(mention_key .. mention_name, '')
220221
if updated_line ~= line then
221222
lines[i] = updated_line
222223
end

0 commit comments

Comments
 (0)