Skip to content

Commit 6fd4d98

Browse files
committed
Support single-line at-mention when no region selected
When using the at-mention feature without selecting a region, the current cursor line is now automatically included. This improves workflow by eliminating the need to manually select a single line.
1 parent 72f25c4 commit 6fd4d98

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

claude-code-ide-mcp.el

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -904,17 +904,21 @@ This should be called when the buffer's context might have changed."
904904
(claude-code-ide-debug "No MCP servers running"))))))
905905

906906
(defun claude-code-ide-mcp-send-at-mentioned ()
907-
"Send at-mentioned notification."
908-
;; Only send if there's an actual region selected
909-
(when (use-region-p)
910-
(let* ((file-path (or (buffer-file-name) ""))
911-
(start-line (1- (line-number-at-pos (region-beginning))))
912-
(end-line (1- (line-number-at-pos (region-end)))))
913-
(claude-code-ide-mcp--send-notification
914-
"at_mentioned"
915-
`((filePath . ,file-path)
916-
(lineStart . ,start-line)
917-
(lineEnd . ,end-line))))))
907+
"Send at-mentioned notification.
908+
If a region is selected, send the selected lines.
909+
Otherwise, send the current line."
910+
(let* ((file-path (or (buffer-file-name) ""))
911+
(start-line (if (use-region-p)
912+
(1- (line-number-at-pos (region-beginning)))
913+
(1- (line-number-at-pos (point)))))
914+
(end-line (if (use-region-p)
915+
(1- (line-number-at-pos (region-end)))
916+
(1- (line-number-at-pos (point))))))
917+
(claude-code-ide-mcp--send-notification
918+
"at_mentioned"
919+
`((filePath . ,file-path)
920+
(lineStart . ,start-line)
921+
(lineEnd . ,end-line)))))
918922

919923
(defun claude-code-ide-mcp-complete-deferred (session tool-name result &optional unique-key)
920924
"Complete a deferred response for SESSION and TOOL-NAME with RESULT.

0 commit comments

Comments
 (0)