Skip to content

Commit d0f55d6

Browse files
committed
fix(input_window): user slash commands were broken
Also, make commands_list async
1 parent c019af6 commit d0f55d6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lua/opencode/api.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function M.prev_message()
262262
require('opencode.ui.navigation').goto_prev_message()
263263
end
264264

265-
function M.submit_input_prompt()
265+
M.submit_input_prompt = Promise.async(function()
266266
if state.display_route then
267267
-- we're displaying /help or something similar, need to clear that and refresh
268268
-- the session data before sending the command
@@ -271,7 +271,7 @@ function M.submit_input_prompt()
271271
end
272272

273273
input_window.handle_submit()
274-
end
274+
end)
275275

276276
function M.mention_file()
277277
local picker = require('opencode.ui.file_picker')
@@ -506,8 +506,8 @@ M.mcp = Promise.async(function()
506506
ui.render_lines(msg)
507507
end)
508508

509-
function M.commands_list()
510-
local commands = config_file.get_user_commands():wait()
509+
M.commands_list = Promise.async(function()
510+
local commands = config_file.get_user_commands():await()
511511
if not commands then
512512
vim.notify('No user commands found. Please check your opencode config file.', vim.log.levels.WARN)
513513
return
@@ -530,7 +530,7 @@ function M.commands_list()
530530

531531
table.insert(msg, '')
532532
ui.render_lines(msg)
533-
end
533+
end)
534534

535535
M.current_model = Promise.async(function()
536536
return core.initialize_current_model()

lua/opencode/ui/input_window.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function M.handle_submit()
7676
end
7777

7878
M._execute_slash_command = function(command)
79-
local slash_commands = require('opencode.api').get_slash_commands()
79+
local slash_commands = require('opencode.api').get_slash_commands():await()
8080
local key = config.get_key_for_function('input_window', 'slash_commands') or '/'
8181

8282
local cmd = command:sub(2):match('^%s*(.-)%s*$')

0 commit comments

Comments
 (0)