Skip to content

Commit 50f922d

Browse files
committed
fix: issues with backmerge
1 parent a750dc8 commit 50f922d

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
@@ -299,6 +299,13 @@ function M.mention()
299299
require('opencode.ui.completion').trigger_completion(char)()
300300
end
301301

302+
function M.context_items()
303+
local config = require('opencode.config')
304+
local char = config.get_key_for_function('input_window', 'context_items')
305+
ui.focus_input({ restore_position = true, start_insert = true })
306+
require('opencode.ui.completion').trigger_completion(char)()
307+
end
308+
302309
function M.slash_commands()
303310
local config = require('opencode.config')
304311
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
@@ -56,6 +56,7 @@ M.defaults = {
5656
['~'] = { 'mention_file', mode = 'i' },
5757
['@'] = { 'mention', mode = 'i' },
5858
['/'] = { 'slash_commands', mode = 'i' },
59+
['#'] = { 'context_items', mode = 'i' },
5960
['<tab>'] = { 'toggle_pane', mode = { 'n', 'i' } },
6061
['<up>'] = { 'prev_prompt_history', mode = { 'n', 'i' } },
6162
['<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
@@ -53,7 +53,8 @@
5353
---@field share? SessionShareInfo
5454

5555
---@class OpencodeKeymapEntry
56-
---@field [1] string # Function name
56+
---@field [1] string # Function nam
57+
5758
---@field mode? string|string[] # Mode(s) for the keymap
5859
---@field desc? string # Keymap description
5960

@@ -66,28 +67,6 @@
6667
---@field accept_all string
6768
---@field deny string
6869

69-
<<<<<<< HEAD
70-
=======
71-
---@class OpencodeKeymapWindow
72-
---@field submit string
73-
---@field submit_insert string
74-
---@field close string
75-
---@field stop string
76-
---@field next_message string
77-
---@field prev_message string
78-
---@field mention_file string # mention files with a file picker
79-
---@field mention string # mention subagents or files with a completion popup
80-
---@field slash_commands string
81-
---@field context_items string # select context items with a completion popup
82-
---@field toggle_pane string
83-
---@field prev_prompt_history string
84-
---@field next_prompt_history string
85-
---@field focus_input string
86-
---@field debug_message string
87-
---@field debug_output string
88-
---@field switch_mode string
89-
---@field select_child_session string
90-
>>>>>>> 31b9b62 (wip: context bar)
9170
---@class OpencodeKeymap
9271
---@field editor OpencodeKeymapEditor
9372
---@field input_window OpencodeKeymapInputWindow
@@ -140,13 +119,8 @@
140119
---@class OpencodeContextConfig
141120
---@field enabled boolean
142121
---@field cursor_data { enabled: boolean }
143-
<<<<<<< HEAD
144-
---@field diagnostics { info: boolean, warning: boolean, error: boolean }
145-
---@field current_file { enabled: boolean, show_full_path: boolean }
146-
=======
147122
---@field diagnostics { enabled:boolean, info: boolean, warning: boolean, error: boolean }
148123
---@field current_file { enabled: boolean }
149-
>>>>>>> 31b9b62 (wip: context bar)
150124
---@field selection { enabled: boolean }
151125
---@field subagents { enabled: boolean }
152126

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)