@@ -39,6 +39,7 @@ M.version = {
3939--- @field env table<string,string> Custom environment variables for Claude terminal.
4040--- @field log_level " trace" | " debug" | " info" | " warn" | " error" Log level.
4141--- @field track_selection boolean Enable sending selection updates to Claude.
42+ --- @field show_terminal_on_at_mention boolean Whether to show terminal when sending @ mentions.
4243--- @field visual_demotion_delay_ms number Milliseconds to wait before demoting a visual selection.
4344--- @field connection_wait_delay number Milliseconds to wait after connection before sending queued @ mentions.
4445--- @field connection_timeout number Maximum time to wait for Claude Code to connect (milliseconds ).
316317--- @return string | nil error Error message if failed
317318function M .send_at_mention (file_path , start_line , end_line , context )
318319 context = context or " command"
320+ local show_terminal = M .state .config .show_terminal_on_at_mention
319321
320322 if not M .state .server then
321323 logger .error (context , " Claude Code integration is not running" )
@@ -324,9 +326,9 @@ function M.send_at_mention(file_path, start_line, end_line, context)
324326
325327 -- Check if Claude Code is connected
326328 if M .is_claude_connected () then
327- -- Claude is connected, send immediately and ensure terminal is visible
329+ -- Claude is connected, send immediately and optionally ensure terminal is visible
328330 local success , error_msg = M ._broadcast_at_mention (file_path , start_line , end_line )
329- if success then
331+ if success and show_terminal then
330332 local terminal = require (" claudecode.terminal" )
331333 terminal .ensure_visible ()
332334 end
@@ -335,9 +337,21 @@ function M.send_at_mention(file_path, start_line, end_line, context)
335337 -- Claude not connected, queue the mention and launch terminal
336338 queue_mention (file_path , start_line , end_line )
337339
338- -- Launch terminal with Claude Code
339- local terminal = require (" claudecode.terminal" )
340- terminal .open ()
340+ -- Claude not connected, queue the mention and optionally launch terminal
341+ local mention_data = {
342+ file_path = file_path ,
343+ start_line = start_line ,
344+ end_line = end_line ,
345+ context = context ,
346+ }
347+
348+ queue_at_mention (mention_data )
349+
350+ if show_terminal then
351+ -- Launch terminal with Claude Code
352+ local terminal = require (" claudecode.terminal" )
353+ terminal .open ()
354+ end
341355
342356 logger .debug (context , " Queued @ mention and launched Claude Code: " .. file_path )
343357
0 commit comments