Skip to content

Commit 4770090

Browse files
authored
feat: enable terminal providers to implement ensure_visible (#103)
Allow terminal providers to implement a custom ensure_visible method. This provides more flexibility for custom terminal providers to handle visibility logic.
1 parent 1da5f67 commit 4770090

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lua/claudecode/terminal.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
--- @field focus_toggle fun(cmd_string: string, env_table: table, effective_config: TerminalConfig)
1212
--- @field get_active_bufnr fun(): number?
1313
--- @field is_available fun(): boolean
14+
--- @field ensure_visible? function
1415
--- @field _get_terminal_for_test fun(): table?
1516

1617
--- @class TerminalConfig
@@ -265,6 +266,13 @@ end
265266
---@return boolean visible True if terminal was opened or already visible
266267
local function ensure_terminal_visible_no_focus(opts_override, cmd_args)
267268
local provider = get_provider()
269+
270+
-- Check if provider has an ensure_visible method
271+
if provider.ensure_visible then
272+
provider.ensure_visible()
273+
return true
274+
end
275+
268276
local active_bufnr = provider.get_active_bufnr()
269277

270278
if is_terminal_visible(active_bufnr) then

0 commit comments

Comments
 (0)