@@ -38,6 +38,7 @@ M.version = {
3838--- @field terminal_cmd string | nil Custom terminal command to use when launching Claude.
3939--- @field log_level " trace" | " debug" | " info" | " warn" | " error" Log level.
4040--- @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.
4142--- @field visual_demotion_delay_ms number Milliseconds to wait before demoting a visual selection.
4243--- @field connection_wait_delay number Milliseconds to wait after connection before sending queued @ mentions.
4344--- @field connection_timeout number Maximum time to wait for Claude Code to connect (milliseconds ).
251252--- @return string | nil error Error message if failed
252253function M .send_at_mention (file_path , start_line , end_line , context )
253254 context = context or " command"
255+ local show_terminal = M .state .config .show_terminal_on_at_mention
254256
255257 if not M .state .server then
256258 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)
259261
260262 -- Check if Claude Code is connected
261263 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
263265 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
265267 local terminal = require (" claudecode.terminal" )
266268 terminal .ensure_visible ()
267269 end
268270 return success , error_msg
269271 else
270- -- Claude not connected, queue the mention and launch terminal
272+ -- Claude not connected, queue the mention and optionally launch terminal
271273 local mention_data = {
272274 file_path = file_path ,
273275 start_line = start_line ,
@@ -277,9 +279,11 @@ function M.send_at_mention(file_path, start_line, end_line, context)
277279
278280 queue_at_mention (mention_data )
279281
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
283287
284288 logger .debug (context , " Queued @ mention and launched Claude Code: " .. file_path )
285289
0 commit comments