Skip to content

Commit

Permalink
fix: conversation/context handler
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Jun 20, 2024
1 parent 887b790 commit 27d80c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
13 changes: 7 additions & 6 deletions plugin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

import sublime
from LSP.plugin import ClientConfig, DottedDict, Request, Session, WorkspaceFolder
from lsp_utils import ApiWrapperInterface, NpmClientHandler, notification_handler
from lsp_utils import ApiWrapperInterface, NpmClientHandler, notification_handler, request_handler

from .constants import (
NTFY_CONVERSATION_CONTEXT,
NTFY_FEATURE_FLAGS_NOTIFICATION,
NTFY_LOG_MESSAGE,
NTFY_PANEL_SOLUTION,
NTFY_PANEL_SOLUTION_DONE,
NTFY_STATUS_NOTIFICATION,
PACKAGE_NAME,
REQ_CHECK_STATUS,
REQ_CONVERSATION_CONTEXT,
REQ_GET_COMPLETIONS,
REQ_GET_COMPLETIONS_CYCLING,
REQ_GET_VERSION,
Expand Down Expand Up @@ -294,10 +294,6 @@ def _handle_feature_flags_notification(self, payload: CopilotPayloadFeatureFlags
def _handle_log_message_notification(self, payload: CopilotPayloadLogMessage) -> None:
pass

@notification_handler(NTFY_CONVERSATION_CONTEXT)
def _handle_conversation_context_notification(self, payload, *args, **kwargs) -> None:
print(payload)

@notification_handler(NTFY_PANEL_SOLUTION)
def _handle_panel_solution_notification(self, payload: CopilotPayloadPanelSolution) -> None:
if not (view := ViewPanelCompletionManager.find_view_by_panel_id(payload["panelId"])):
Expand All @@ -322,6 +318,11 @@ def _handle_panel_solution_done_notification(self, payload) -> None:
def _handle_status_notification_notification(self, payload: CopilotPayloadStatusNotification) -> None:
pass

@request_handler(REQ_CONVERSATION_CONTEXT)
def _handle_conversation_context_request(self, payload, respond: Callable[[Any], None]) -> None:
# {'conversationId': 'e3b0d5e3-0c3b-4292-a5ea-15d6003e7c45', 'turnId': '09ac7601-6c28-4617-b3e4-13f5ff8502b7', 'skillId': 'current-editor'}
print(f'{payload = }')

@_guard_view()
@debounce()
def request_get_completions(self, view: sublime.View) -> None:
Expand Down
18 changes: 9 additions & 9 deletions plugin/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@
# Copilot Chat requests #
# --------------------- #

REQ_CONVERSATION_PRECONDITIONS = "conversation/preconditions"
REQ_CONVERSATION_PERSISTANCE = "conversation/persistance"
REQ_CONVERSATION_CREATE = "conversation/create"
REQ_CONVERSATION_AGENTS = "conversation/agents"
REQ_CONVERSATION_TURN = "conversation/turn"
REQ_CONVERSATION_TURN_DELETE = "conversation/turnDelete"
REQ_CONVERSATION_DESTROY = "conversation/destroy"
REQ_CONVERSATION_RATING = "conversation/rating"
REQ_CONVERSATION_CONTEXT = "conversation/context"
REQ_CONVERSATION_COPY_CODE = "conversation/copyCode"
REQ_CONVERSATION_CREATE = "conversation/create"
REQ_CONVERSATION_DESTROY = "conversation/destroy"
REQ_CONVERSATION_INSERT_CODE = "conversation/insertCode"
REQ_CONVERSATION_PERSISTANCE = "conversation/persistance"
REQ_CONVERSATION_PRECONDITIONS = "conversation/preconditions"
REQ_CONVERSATION_RATING = "conversation/rating"
REQ_CONVERSATION_TEMPLATES = "conversation/templates"
REQ_CONVERSATION_TURN = "conversation/turn"
REQ_CONVERSATION_TURN_DELETE = "conversation/turnDelete"

# --------------------- #
# Copilot notifications #
# --------------------- #

NTFY_FEATURE_FLAGS_NOTIFICATION = "featureFlagsNotification" # done
NTFY_LOG_MESSAGE = "LogMessage" # done
NTFY_PROGRESS = "$/progress"
NTFY_PANEL_SOLUTION = "PanelSolution" # done
NTFY_PANEL_SOLUTION_DONE = "PanelSolutionsDone" # done
NTFY_PROGRESS = "$/progress"
NTFY_STATUS_NOTIFICATION = "statusNotification" # done
NTFY_CONVERSATION_CONTEXT = "conversation/context"

0 comments on commit 27d80c8

Please sign in to comment.