@@ -38,6 +38,7 @@ M.version = {
38
38
--- @field terminal_cmd string | nil Custom terminal command to use when launching Claude.
39
39
--- @field log_level " trace" | " debug" | " info" | " warn" | " error" Log level.
40
40
--- @field track_selection boolean Enable sending selection updates to Claude.
41
+ --- @field show_terminal_on_at_mention boolean Whether to show terminal when sending @ mentions.
41
42
--- @field visual_demotion_delay_ms number Milliseconds to wait before demoting a visual selection.
42
43
--- @field connection_wait_delay number Milliseconds to wait after connection before sending queued @ mentions.
43
44
--- @field connection_timeout number Maximum time to wait for Claude Code to connect (milliseconds ).
251
252
--- @return string | nil error Error message if failed
252
253
function M .send_at_mention (file_path , start_line , end_line , context )
253
254
context = context or " command"
255
+ local show_terminal = M .state .config .show_terminal_on_at_mention
254
256
255
257
if not M .state .server then
256
258
logger .error (context , " Claude Code integration is not running" )
@@ -259,15 +261,15 @@ function M.send_at_mention(file_path, start_line, end_line, context)
259
261
260
262
-- Check if Claude Code is connected
261
263
if M .is_claude_connected () then
262
- -- Claude is connected, send immediately and ensure terminal is visible
264
+ -- Claude is connected, send immediately and optionally ensure terminal is visible
263
265
local success , error_msg = M ._broadcast_at_mention (file_path , start_line , end_line )
264
- if success then
266
+ if success and show_terminal then
265
267
local terminal = require (" claudecode.terminal" )
266
268
terminal .ensure_visible ()
267
269
end
268
270
return success , error_msg
269
271
else
270
- -- Claude not connected, queue the mention and launch terminal
272
+ -- Claude not connected, queue the mention and optionally launch terminal
271
273
local mention_data = {
272
274
file_path = file_path ,
273
275
start_line = start_line ,
@@ -277,9 +279,11 @@ function M.send_at_mention(file_path, start_line, end_line, context)
277
279
278
280
queue_at_mention (mention_data )
279
281
280
- -- Launch terminal with Claude Code
281
- local terminal = require (" claudecode.terminal" )
282
- terminal .open ()
282
+ if show_terminal then
283
+ -- Launch terminal with Claude Code
284
+ local terminal = require (" claudecode.terminal" )
285
+ terminal .open ()
286
+ end
283
287
284
288
logger .debug (context , " Queued @ mention and launched Claude Code: " .. file_path )
285
289
0 commit comments