Skip to content

Commit 0567056

Browse files
committed
fix: issues with backmerge
1 parent 9dc7885 commit 0567056

6 files changed

Lines changed: 18 additions & 34 deletions

File tree

lua/opencode/api.lua

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

291+
function M.context_items()
292+
local config = require('opencode.config')
293+
local char = config.get_key_for_function('input_window', 'context_items')
294+
ui.focus_input({ restore_position = true, start_insert = true })
295+
require('opencode.ui.completion').trigger_completion(char)()
296+
end
297+
291298
function M.slash_commands()
292299
local config = require('opencode.config')
293300
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ function M.setup(opts)
1212
api.setup()
1313
keymap.setup(config.keymap)
1414
require('opencode.ui.completion').setup()
15-
local ui_conf = config.get('ui')
16-
if ui_conf.display_context_size or ui_conf.display_cost then
17-
require('opencode.models').setup()
18-
end
15+
1916
require('opencode.ui.context_bar').setup()
2017
require('opencode.event_manager').setup()
2118
require('opencode.ui.context_bar').setup()

lua/opencode/types.lua

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

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

@@ -63,28 +64,6 @@
6364
---@field accept_all string
6465
---@field deny string
6566

66-
<<<<<<< HEAD
67-
=======
68-
---@class OpencodeKeymapWindow
69-
---@field submit string
70-
---@field submit_insert string
71-
---@field close string
72-
---@field stop string
73-
---@field next_message string
74-
---@field prev_message string
75-
---@field mention_file string # mention files with a file picker
76-
---@field mention string # mention subagents or files with a completion popup
77-
---@field slash_commands string
78-
---@field context_items string # select context items with a completion popup
79-
---@field toggle_pane string
80-
---@field prev_prompt_history string
81-
---@field next_prompt_history string
82-
---@field focus_input string
83-
---@field debug_message string
84-
---@field debug_output string
85-
---@field switch_mode string
86-
---@field select_child_session string
87-
>>>>>>> 31b9b62 (wip: context bar)
8867
---@class OpencodeKeymap
8968
---@field editor OpencodeKeymapEditor
9069
---@field input_window OpencodeKeymapInputWindow
@@ -122,13 +101,8 @@
122101
---@class OpencodeContextConfig
123102
---@field enabled boolean
124103
---@field cursor_data { enabled: boolean }
125-
<<<<<<< HEAD
126-
---@field diagnostics { info: boolean, warning: boolean, error: boolean }
127-
---@field current_file { enabled: boolean, show_full_path: boolean }
128-
=======
129104
---@field diagnostics { enabled:boolean, info: boolean, warning: boolean, error: boolean }
130105
---@field current_file { enabled: boolean }
131-
>>>>>>> 31b9b62 (wip: context bar)
132106
---@field selection { enabled: boolean }
133107
---@field subagents { enabled: boolean }
134108

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)