Skip to content

feat: add Claude Haiku model and update type annotations #110

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
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion lua/claudecode/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ M.defaults = {
keep_terminal_focus = false, -- If true, moves focus back to terminal after diff opens
},
models = {
{ name = "Claude Opus 4 (Latest)", value = "opus" },
{ name = "Claude Opus 4.1 (Latest)", value = "opus" },
{ name = "Claude Sonnet 4 (Latest)", value = "sonnet" },
{ name = "Claude Haiku 3.5 (Latest)", value = "haiku" },
},
terminal = nil, -- Will be lazy-loaded to avoid circular dependency
}
Expand Down
12 changes: 8 additions & 4 deletions lua/claudecode/diff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ local logger = require("claudecode.logger")

-- Global state management for active diffs

local active_diffs = {}
local autocmd_group
---@type ClaudeCodeConfig
local config

---@type number
local autocmd_group
---Get or create the autocmd group
local function get_autocmd_group()
if not autocmd_group then
Expand Down Expand Up @@ -112,7 +113,7 @@ local function is_buffer_dirty(file_path)
end

---Setup the diff module
---@param user_config table? The configuration passed from init.lua
---@param user_config ClaudeCodeConfig? The configuration passed from init.lua
function M.setup(user_config)
-- Store the configuration for later use
config = user_config or {}
Expand Down Expand Up @@ -336,6 +337,9 @@ function M._open_native_diff(old_file_path, new_file_path, new_file_contents, ta
}
end

---@type table<string, table>
local active_diffs = {}

---Register diff state for tracking
---@param tab_name string Unique identifier for the diff
---@param diff_data table Diff state data
Expand Down Expand Up @@ -638,7 +642,7 @@ function M._create_diff_view_from_window(target_window, old_file_path, new_buffe
if terminal_win then
vim.api.nvim_set_current_win(terminal_win)
end
end, 0)
end)
end

-- Return window information for later storage
Expand Down
2 changes: 1 addition & 1 deletion lua/claudecode/server/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ M.state = {
}

---Initialize the WebSocket server
---@param config table Configuration options
---@param config ClaudeCodeConfig Configuration options
---@param auth_token string|nil The authentication token for validating connections
---@return boolean success Whether server started successfully
---@return number|string port_or_error Port number or error message
Expand Down
2 changes: 1 addition & 1 deletion lua/claudecode/server/tcp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function M.find_available_port(min_port, max_port)
end

---Create and start a TCP server
---@param config table Server configuration
---@param config ClaudeCodeConfig Server configuration
---@param callbacks table Callback functions
---@param auth_token string|nil Authentication token for validating connections
---@return TCPServer|nil server The server object, or nil on error
Expand Down