Skip to content

Commit 5843537

Browse files
committed
attempting to work on the Conversation Edit
1 parent c466de6 commit 5843537

File tree

5 files changed

+308
-183
lines changed

5 files changed

+308
-183
lines changed

plugin/client.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from functools import wraps
1010
from typing import Any, cast
1111
from urllib.parse import urlparse
12+
import uuid
1213

1314
import jmespath
1415
import sublime
@@ -382,6 +383,36 @@ def on_server_notification_async(self, notification: Notification) -> None:
382383
wcm.follow_up = message
383384

384385
wcm.update()
386+
elif (
387+
(token := notification.params["token"]).startswith("copilot_pedit://")
388+
and (params := notification.params["value"])
389+
and (window := WindowConversationManager.find_window_by_token_id(token))
390+
):
391+
wcm = WindowConversationManager(window)
392+
for update in params:
393+
if "editConversationId" in update:
394+
wcm.edit_conversation_id = update["editConversationId"]
395+
if update["fileGenerationStatus"] == "edit-conversation-begin":
396+
wcm.is_waiting = True
397+
wcm.open()
398+
print("Open Panel")
399+
400+
if update.get("fileGenerationStatus") == "edit-conversation-end":
401+
wcm.is_waiting = False
402+
403+
if update.get("fileGenerationStatus") == "edit-plan-generated":
404+
if "editDescription" in update:
405+
wcm.append_conversation_entry({
406+
"kind": "report",
407+
"conversationId": wcm.edit_conversation_id,
408+
"reply": update["editDescription"],
409+
"turnId": update.get("editTurnId", str(uuid.uuid4())),
410+
"references": [],
411+
"annotations": [],
412+
"hideText": False,
413+
"warnings": [],
414+
})
415+
wcm.update()
385416

386417
@notification_handler(NTFY_FEATURE_FLAGS_NOTIFICATION)
387418
def _handle_feature_flags_notification(self, payload: CopilotPayloadFeatureFlagsNotification) -> None:

0 commit comments

Comments
 (0)