Skip to content

Commit ebc3500

Browse files
committed
Improve @cursor context details
1 parent e1818fd commit ebc3500

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

eca-chat.el

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,25 @@ If FORCE? decide to OPEN? or not."
11251125
("mcpResource" (propertize (concat eca-chat-context-prefix (plist-get context :server) ":" (plist-get context :name))
11261126
'eca-chat-context-item context
11271127
'font-lock-face 'eca-chat-context-mcp-resource-face))
1128-
("cursor" (propertize (concat eca-chat-context-prefix "cursor")
1128+
("cursor" (propertize (concat eca-chat-context-prefix "cursor"
1129+
"("
1130+
(-some-> (plist-get eca-chat--cursor-context :path)
1131+
(f-filename))
1132+
":"
1133+
(-some->>
1134+
(-> eca-chat--cursor-context
1135+
(plist-get :position)
1136+
(plist-get :start)
1137+
(plist-get :line))
1138+
(funcall #'number-to-string))
1139+
":"
1140+
(-some->>
1141+
(-> eca-chat--cursor-context
1142+
(plist-get :position)
1143+
(plist-get :start)
1144+
(plist-get :character))
1145+
(funcall #'number-to-string))
1146+
")")
11291147
'eca-chat-context-item context
11301148
'font-lock-face 'eca-chat-context-cursor-face))
11311149
(_ (propertize (concat eca-chat-context-prefix "unkown:" type)
@@ -1263,10 +1281,11 @@ of (LINE . CHARACTER) representing the current selection or cursor position."
12631281
((start-line . start-character) start)
12641282
((end-line . end-character) end))
12651283
(eca-chat--with-current-buffer buffer
1266-
(setq eca-chat--cursor-context
1267-
(list :path path
1268-
:position (list :start (list :line start-line :character start-character)
1269-
:end (list :line end-line :character end-character))))))))))))
1284+
(setq eca-chat--cursor-context
1285+
(list :path path
1286+
:position (list :start (list :line start-line :character start-character)
1287+
:end (list :line end-line :character end-character))))
1288+
(eca-chat--refresh-context)))))))))
12701289

12711290
(defun eca-chat--track-cursor-position-schedule ()
12721291
"Debounce `eca-chat--track-cursor' via an idle timer."

0 commit comments

Comments
 (0)