Skip to content

feat: enable terminal providers to implement ensure_visible #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lua/claudecode/terminal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
--- @field focus_toggle fun(cmd_string: string, env_table: table, effective_config: TerminalConfig)
--- @field get_active_bufnr fun(): number?
--- @field is_available fun(): boolean
--- @field ensure_visible? function
--- @field _get_terminal_for_test fun(): table?

--- @class TerminalConfig
Expand Down Expand Up @@ -265,6 +266,13 @@ end
---@return boolean visible True if terminal was opened or already visible
local function ensure_terminal_visible_no_focus(opts_override, cmd_args)
local provider = get_provider()

-- Check if provider has an ensure_visible method
if provider.ensure_visible then
provider.ensure_visible()
return true
end

local active_bufnr = provider.get_active_bufnr()

if is_terminal_visible(active_bufnr) then
Expand Down