Skip to content

Commit 3b81fda

Browse files
committed
fix: issues with backmerge
1 parent cb70f9a commit 3b81fda

File tree

6 files changed

+18
-30
lines changed

6 files changed

+18
-30
lines changed

lua/opencode/api.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,13 @@ function M.mention()
293293
require('opencode.ui.completion').trigger_completion(char)()
294294
end
295295

296+
function M.context_items()
297+
local config = require('opencode.config')
298+
local char = config.get_key_for_function('input_window', 'context_items')
299+
ui.focus_input({ restore_position = true, start_insert = true })
300+
require('opencode.ui.completion').trigger_completion(char)()
301+
end
302+
296303
function M.slash_commands()
297304
local config = require('opencode.config')
298305
local char = config.get_key_for_function('input_window', 'slash_commands')

lua/opencode/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ M.defaults = {
5555
['~'] = { 'mention_file', mode = 'i' },
5656
['@'] = { 'mention', mode = 'i' },
5757
['/'] = { 'slash_commands', mode = 'i' },
58+
['#'] = { 'context_items', mode = 'i' },
5859
['<tab>'] = { 'toggle_pane', mode = { 'n', 'i' } },
5960
['<up>'] = { 'prev_prompt_history', mode = { 'n', 'i' } },
6061
['<down>'] = { 'next_prompt_history', mode = { 'n', 'i' } },

lua/opencode/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function M.setup(opts)
1313
require('opencode.keymap').setup(config.keymap)
1414
require('opencode.ui.completion').setup()
1515
require('opencode.event_manager').setup()
16+
require('opencode.ui.context_bar').setup()
1617
end
1718

1819
return M

lua/opencode/types.lua

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
---@field revert? SessionRevertInfo
5050

5151
---@class OpencodeKeymapEntry
52-
---@field [1] string # Function name
52+
---@field [1] string # Function nam
53+
5354
---@field mode? string|string[] # Mode(s) for the keymap
5455
---@field desc? string # Keymap description
5556

@@ -62,28 +63,6 @@
6263
---@field accept_all string
6364
---@field deny string
6465

65-
<<<<<<< HEAD
66-
=======
67-
---@class OpencodeKeymapWindow
68-
---@field submit string
69-
---@field submit_insert string
70-
---@field close string
71-
---@field stop string
72-
---@field next_message string
73-
---@field prev_message string
74-
---@field mention_file string # mention files with a file picker
75-
---@field mention string # mention subagents or files with a completion popup
76-
---@field slash_commands string
77-
---@field context_items string # select context items with a completion popup
78-
---@field toggle_pane string
79-
---@field prev_prompt_history string
80-
---@field next_prompt_history string
81-
---@field focus_input string
82-
---@field debug_message string
83-
---@field debug_output string
84-
---@field switch_mode string
85-
---@field select_child_session string
86-
>>>>>>> 31b9b62 (wip: context bar)
8766
---@class OpencodeKeymap
8867
---@field editor OpencodeKeymapEditor
8968
---@field input_window OpencodeKeymapInputWindow
@@ -136,13 +115,8 @@
136115
---@class OpencodeContextConfig
137116
---@field enabled boolean
138117
---@field cursor_data { enabled: boolean }
139-
<<<<<<< HEAD
140-
---@field diagnostics { info: boolean, warning: boolean, error: boolean }
141-
---@field current_file { enabled: boolean, show_full_path: boolean }
142-
=======
143118
---@field diagnostics { enabled:boolean, info: boolean, warning: boolean, error: boolean }
144119
---@field current_file { enabled: boolean }
145-
>>>>>>> 31b9b62 (wip: context bar)
146120
---@field selection { enabled: boolean }
147121
---@field subagents { enabled: boolean }
148122

lua/opencode/ui/completion/context.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local config = require('opencode.config').get()
1+
local config = require('opencode.config')
22
local context = require('opencode.context')
33
local state = require('opencode.state')
44
local icons = require('opencode.ui.icons')
@@ -89,7 +89,8 @@ local context_source = {
8989
complete = function(completion_context)
9090
local input = completion_context.input or ''
9191

92-
if completion_context.trigger_char ~= '#' then
92+
local expected_trigger = config.get_key_for_function('input_window', 'context_items')
93+
if completion_context.trigger_char ~= expected_trigger then
9394
return {}
9495
end
9596

lua/opencode/ui/completion/engines/blink_cmp.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ function Source:get_trigger_characters()
1212
local config = require('opencode.config')
1313
local mention_key = config.get_key_for_function('input_window', 'mention')
1414
local slash_key = config.get_key_for_function('input_window', 'slash_commands')
15+
local context_key = config.get_key_for_function('input_window', 'context_items')
1516
local triggers = {}
1617
if mention_key then
1718
table.insert(triggers, mention_key)
1819
end
1920
if slash_key then
2021
table.insert(triggers, slash_key)
2122
end
23+
if context_key then
24+
table.insert(triggers, context_key)
25+
end
2226
return triggers
2327
end
2428

0 commit comments

Comments
 (0)