Skip to content

Commit 4a84caa

Browse files
committed
Fix annotations
1 parent 472ec4c commit 4a84caa

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

lua/claudecode/terminal/external.lua

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
---Launches Claude Code in an external terminal application using a user-specified command.
33
---@module 'claudecode.terminal.external'
44

5-
--- @type TerminalProvider
5+
---@type ClaudeCodeTerminalProvider
66
local M = {}
77

88
local logger = require("claudecode.logger")
99
local utils = require("claudecode.utils")
1010

1111
local jobid = nil
12-
---@type TerminalConfig
12+
---@type ClaudeCodeTerminalConfig
1313
local config
1414

1515
local function cleanup_state()
@@ -22,15 +22,15 @@ local function is_valid()
2222
return jobid and jobid > 0
2323
end
2424

25-
--- @param term_config TerminalConfig
25+
---@param term_config ClaudeCodeTerminalConfig
2626
function M.setup(term_config)
2727
config = term_config or {}
2828
end
2929

30-
--- @param cmd_string string
31-
--- @param env_table table
32-
--- @param effective_config table
33-
--- @param focus boolean|nil
30+
---@param cmd_string string
31+
---@param env_table table
32+
---@param effective_config table
33+
---@param focus boolean?
3434
function M.open(cmd_string, env_table, effective_config, focus)
3535
focus = utils.normalize_focus(focus)
3636

@@ -54,10 +54,7 @@ function M.open(cmd_string, env_table, effective_config, focus)
5454

5555
-- Replace %s in the template with the Claude command
5656
if not external_cmd:find("%%s") then
57-
vim.notify(
58-
"external_terminal_cmd must contain '%s' placeholder for the Claude command.",
59-
vim.log.levels.ERROR
60-
)
57+
vim.notify("external_terminal_cmd must contain '%s' placeholder for the Claude command.", vim.log.levels.ERROR)
6158
return
6259
end
6360

@@ -94,9 +91,9 @@ function M.close()
9491
end
9592

9693
--- Simple toggle: always start external terminal (can't hide external terminals)
97-
--- @param cmd_string string
98-
--- @param env_table table
99-
--- @param effective_config table
94+
---@param cmd_string string
95+
---@param env_table table
96+
---@param effective_config table
10097
function M.simple_toggle(cmd_string, env_table, effective_config)
10198
if is_valid() then
10299
-- External terminal is running, stop it
@@ -108,42 +105,39 @@ function M.simple_toggle(cmd_string, env_table, effective_config)
108105
end
109106

110107
--- Smart focus toggle: same as simple toggle for external terminals
111-
--- @param cmd_string string
112-
--- @param env_table table
113-
--- @param effective_config table
108+
---@param cmd_string string
109+
---@param env_table table
110+
---@param effective_config table
114111
function M.focus_toggle(cmd_string, env_table, effective_config)
115112
-- For external terminals, focus toggle behaves the same as simple toggle
116113
-- since we can't detect or control focus of external windows
117114
M.simple_toggle(cmd_string, env_table, effective_config)
118115
end
119116

120117
--- Legacy toggle function for backward compatibility
121-
--- @param cmd_string string
122-
--- @param env_table table
123-
--- @param effective_config table
118+
---@param cmd_string string
119+
---@param env_table table
120+
---@param effective_config table
124121
function M.toggle(cmd_string, env_table, effective_config)
125122
M.simple_toggle(cmd_string, env_table, effective_config)
126123
end
127124

128-
--- @return number|nil
125+
---@return number?
129126
function M.get_active_bufnr()
130127
-- External terminals don't have associated Neovim buffers
131128
return nil
132129
end
133130

134131
--- No-op function for external terminals since we can't ensure visibility of external windows
135-
function M.ensure_visible()
136-
-- For external terminals, we can't control window visibility
137-
-- This is a no-op to prevent unnecessary buffer searches
138-
end
132+
function M.ensure_visible() end
139133

140-
--- @return boolean
134+
---@return boolean
141135
function M.is_available()
142136
-- Availability is checked by terminal.lua before this provider is selected
143137
return true
144138
end
145139

146-
--- @return table|nil
140+
---@return table?
147141
function M._get_terminal_for_test()
148142
-- For testing purposes, return job info if available
149143
if is_valid() then

lua/claudecode/types.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@
3232
---@alias ClaudeCodeSplitSide "left"|"right"
3333

3434
-- In-tree terminal provider names
35-
---@alias ClaudeCodeTerminalProviderName "auto"|"snacks"|"native"
35+
---@alias ClaudeCodeTerminalProviderName "auto"|"snacks"|"native"|"external"
36+
37+
-- Terminal provider-specific options
38+
---@class ClaudeCodeTerminalProviderOptions
39+
---@field external_terminal_cmd string? Command template for external terminal (e.g., "alacritty -e %s")
3640

3741
-- @ mention queued for Claude Code
3842
---@class ClaudeCodeMention
@@ -61,6 +65,7 @@
6165
---@field provider ClaudeCodeTerminalProviderName|ClaudeCodeTerminalProvider
6266
---@field show_native_term_exit_tip boolean
6367
---@field terminal_cmd string?
68+
---@field provider_opts ClaudeCodeTerminalProviderOptions?
6469
---@field auto_close boolean
6570
---@field env table<string, string>
6671
---@field snacks_win_opts table

0 commit comments

Comments
 (0)