Skip to content

Commit e24d0db

Browse files
John-Linclaude
andcommitted
fix: make show_terminal_on_at_mention optional for backward compatibility
- Allow show_terminal_on_at_mention to be nil in config validation - Users no longer need to explicitly set this option - Default behavior remains showing terminal on @ mentions - Add test for invalid type validation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 65de4fc commit e24d0db

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lua/claudecode/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function M.validate(config)
5656

5757
assert(type(config.track_selection) == "boolean", "track_selection must be a boolean")
5858

59-
assert(type(config.show_terminal_on_at_mention) == "boolean", "show_terminal_on_at_mention must be a boolean")
59+
assert(config.show_terminal_on_at_mention == nil or type(config.show_terminal_on_at_mention) == "boolean", "show_terminal_on_at_mention must be a boolean")
6060

6161
assert(
6262
type(config.visual_demotion_delay_ms) == "number" and config.visual_demotion_delay_ms >= 0,

tests/unit/config_spec.lua

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,32 @@ describe("Configuration", function()
129129
expect(success).to_be_false()
130130
end)
131131

132+
it("should reject invalid show_terminal_on_at_mention type", function()
133+
local invalid_config = {
134+
port_range = { min = 10000, max = 65535 },
135+
auto_start = true,
136+
log_level = "debug",
137+
track_selection = false,
138+
show_terminal_on_at_mention = "invalid", -- Should be boolean
139+
visual_demotion_delay_ms = 50,
140+
diff_opts = {
141+
auto_close_on_accept = true,
142+
show_diff_stats = true,
143+
vertical_split = true,
144+
open_in_current_tab = true,
145+
},
146+
models = {
147+
{ name = "Test Model", value = "test-model" },
148+
},
149+
}
150+
151+
local success, _ = pcall(function()
152+
config.validate(invalid_config)
153+
end)
154+
155+
expect(success).to_be_false()
156+
end)
157+
132158
it("should merge user config with defaults", function()
133159
local user_config = {
134160
auto_start = true,
@@ -141,6 +167,7 @@ describe("Configuration", function()
141167
expect(merged_config.log_level).to_be("debug")
142168
expect(merged_config.port_range.min).to_be(config.defaults.port_range.min)
143169
expect(merged_config.track_selection).to_be(config.defaults.track_selection)
170+
expect(merged_config.show_terminal_on_at_mention).to_be(config.defaults.show_terminal_on_at_mention)
144171
expect(merged_config.models).to_be_table()
145172
end)
146173

0 commit comments

Comments
 (0)