Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
from __future__ import annotations

from LSP.plugin import register_plugin, unregister_plugin

from .client import CopilotPlugin
from .commands import (
CopilotAcceptCompletionCommand,
CopilotAcceptPanelCompletionCommand,
CopilotAcceptPanelCompletionShimCommand,
CopilotAskCompletionsCommand,
CopilotCheckFileStatusCommand,
CopilotCheckStatusCommand,
CopilotClosePanelCompletionCommand,
CopilotConversationAgentsCommand,
CopilotConversationChatCommand,
CopilotConversationChatShimCommand,
CopilotConversationCloseCommand,
CopilotConversationCopyCodeCommand,
CopilotConversationDebugCommand,
CopilotConversationDestroyCommand,
CopilotConversationDestroyShimCommand,
CopilotConversationInsertCodeCommand,
CopilotConversationInsertCodeShimCommand,
CopilotConversationRatingCommand,
CopilotConversationRatingShimCommand,
CopilotConversationTemplatesCommand,
CopilotConversationToggleReferencesBlockCommand,
CopilotConversationTurnDeleteCommand,
CopilotConversationTurnDeleteShimCommand,
CopilotGetPanelCompletionsCommand,
CopilotGetPromptCommand,
CopilotGetVersionCommand,
CopilotNextCompletionCommand,
CopilotPrepareAndEditSettingsCommand,
CopilotPreviousCompletionCommand,
CopilotRejectCompletionCommand,
CopilotSendAnyRequestCommand,
CopilotSignInCommand,
CopilotSignInWithGithubTokenCommand,
CopilotSignOutCommand,
CopilotToggleConversationChatCommand,
)
from .commands import CopilotAcceptCompletionCommand
from .commands import CopilotAcceptPanelCompletionCommand
from .commands import CopilotAcceptPanelCompletionShimCommand
from .commands import CopilotAskCompletionsCommand
from .commands import CopilotCheckFileStatusCommand
from .commands import CopilotCheckStatusCommand
from .commands import CopilotClosePanelCompletionCommand
from .commands import CopilotConversationAgentsCommand
from .commands import CopilotConversationChatCommand
from .commands import CopilotConversationChatShimCommand
from .commands import CopilotConversationCloseCommand
from .commands import CopilotConversationCopyCodeCommand
from .commands import CopilotConversationDebugCommand
from .commands import CopilotConversationDestroyCommand
from .commands import CopilotConversationDestroyShimCommand
from .commands import CopilotConversationInsertCodeCommand
from .commands import CopilotConversationInsertCodeShimCommand
from .commands import CopilotConversationRatingCommand
from .commands import CopilotConversationRatingShimCommand
from .commands import CopilotConversationTemplatesCommand
from .commands import CopilotConversationToggleReferencesBlockCommand
from .commands import CopilotConversationTurnDeleteCommand
from .commands import CopilotConversationTurnDeleteShimCommand
from .commands import CopilotGetPanelCompletionsCommand
from .commands import CopilotGetPromptCommand
from .commands import CopilotGetVersionCommand
from .commands import CopilotNextCompletionCommand
from .commands import CopilotPrepareAndEditSettingsCommand
from .commands import CopilotPreviousCompletionCommand
from .commands import CopilotRejectCompletionCommand
from .commands import CopilotSendAnyRequestCommand
from .commands import CopilotSignInCommand
from .commands import CopilotSignInWithGithubTokenCommand
from .commands import CopilotSignOutCommand
from .commands import CopilotToggleConversationChatCommand
from .constants import SERVER_VERSION
from .helpers import CopilotIgnore
from .listeners import EventListener, ViewEventListener, copilot_ignore_observer
from .listeners import copilot_ignore_observer
from .listeners import EventListener
from .listeners import ViewEventListener
from .utils import all_windows
from .version_manager import version_manager
from LSP.plugin import register_plugin
from LSP.plugin import unregister_plugin

__all__ = (
# ST: core
Expand Down
108 changes: 55 additions & 53 deletions plugin/client.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,65 @@
from __future__ import annotations

import functools
import json
import weakref
from .constants import NTFY_FEATURE_FLAGS_NOTIFICATION
from .constants import NTFY_LOG_MESSAGE
from .constants import NTFY_PANEL_SOLUTION
from .constants import NTFY_PANEL_SOLUTION_DONE
from .constants import NTFY_STATUS_NOTIFICATION
from .constants import PACKAGE_NAME
from .constants import REQ_CHECK_STATUS
from .constants import REQ_CONVERSATION_CONTEXT
from .constants import REQ_GET_COMPLETIONS
from .constants import REQ_GET_COMPLETIONS_CYCLING
from .helpers import ActivityIndicator
from .helpers import CopilotIgnore
from .helpers import GithubInfo
from .helpers import prepare_completion_request_doc
from .helpers import preprocess_completions
from .helpers import preprocess_panel_completions
from .log import log_error
from .log import log_info
from .log import log_warning
from .template import load_string_template
from .types import AccountStatus
from .types import CopilotPayloadCompletions
from .types import CopilotPayloadConversationContext
from .types import CopilotPayloadFeatureFlagsNotification
from .types import CopilotPayloadLogMessage
from .types import CopilotPayloadPanelSolution
from .types import CopilotPayloadSignInConfirm
from .types import CopilotPayloadStatusNotification
from .types import NetworkProxy
from .types import T_Callable
from .ui import ViewCompletionManager
from .ui import ViewPanelCompletionManager
from .ui import WindowConversationManager
from .utils import all_views
from .utils import all_windows
from .utils import debounce
from .utils import find_view_by_id
from .utils import get_session_setting
from .utils import status_message
from .version_manager import version_manager
from collections.abc import Callable
from dataclasses import dataclass
from functools import wraps
from typing import Any, cast
from LSP.plugin import AbstractPlugin
from LSP.plugin import ClientConfig
from LSP.plugin import DottedDict
from LSP.plugin import Notification
from LSP.plugin import Request
from LSP.plugin import Session
from LSP.plugin import WorkspaceFolder
from lsp_utils import notification_handler
from lsp_utils import request_handler
from typing import Any
from typing import cast
from typing_extensions import override
from urllib.parse import urlparse

import functools
import json
import sublime
from LSP.plugin import AbstractPlugin, ClientConfig, DottedDict, Notification, Request, Session, WorkspaceFolder
from lsp_utils import notification_handler, request_handler
from typing_extensions import override

from .constants import (
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,
)
from .helpers import (
ActivityIndicator,
CopilotIgnore,
GithubInfo,
prepare_completion_request_doc,
preprocess_completions,
preprocess_panel_completions,
)
from .log import log_error, log_info, log_warning
from .template import load_string_template
from .types import (
AccountStatus,
CopilotPayloadCompletions,
CopilotPayloadConversationContext,
CopilotPayloadFeatureFlagsNotification,
CopilotPayloadLogMessage,
CopilotPayloadPanelSolution,
CopilotPayloadSignInConfirm,
CopilotPayloadStatusNotification,
NetworkProxy,
T_Callable,
)
from .ui import ViewCompletionManager, ViewPanelCompletionManager, WindowConversationManager
from .utils import (
all_views,
all_windows,
debounce,
find_view_by_id,
get_session_setting,
status_message,
)
from .version_manager import version_manager
import weakref

WindowId = int

Expand Down
142 changes: 70 additions & 72 deletions plugin/commands.py
Original file line number Diff line number Diff line change
@@ -1,82 +1,80 @@
from __future__ import annotations

import json
import os
import uuid
from .client import CopilotPlugin
from .constants import COPILOT_OUTPUT_PANEL_PREFIX
from .constants import PACKAGE_NAME
from .constants import REQ_CHECK_STATUS
from .constants import REQ_CONVERSATION_AGENTS
from .constants import REQ_CONVERSATION_CREATE
from .constants import REQ_CONVERSATION_DESTROY
from .constants import REQ_CONVERSATION_PRECONDITIONS
from .constants import REQ_CONVERSATION_RATING
from .constants import REQ_CONVERSATION_TEMPLATES
from .constants import REQ_CONVERSATION_TURN
from .constants import REQ_CONVERSATION_TURN_DELETE
from .constants import REQ_FILE_CHECK_STATUS
from .constants import REQ_GET_PANEL_COMPLETIONS
from .constants import REQ_GET_PROMPT
from .constants import REQ_GET_VERSION
from .constants import REQ_NOTIFY_ACCEPTED
from .constants import REQ_NOTIFY_REJECTED
from .constants import REQ_SIGN_IN_CONFIRM
from .constants import REQ_SIGN_IN_INITIATE
from .constants import REQ_SIGN_IN_WITH_GITHUB_TOKEN
from .constants import REQ_SIGN_OUT
from .decorators import must_be_active_view
from .helpers import GithubInfo
from .helpers import prepare_completion_request_doc
from .helpers import prepare_conversation_turn_request
from .helpers import preprocess_chat_message
from .helpers import preprocess_message_for_html
from .log import log_info
from .types import CopilotConversationDebugTemplates
from .types import CopilotPayloadConversationCreate
from .types import CopilotPayloadConversationPreconditions
from .types import CopilotPayloadConversationTemplate
from .types import CopilotPayloadFileStatus
from .types import CopilotPayloadGetVersion
from .types import CopilotPayloadNotifyAccepted
from .types import CopilotPayloadNotifyRejected
from .types import CopilotPayloadPanelCompletionSolutionCount
from .types import CopilotPayloadSignInConfirm
from .types import CopilotPayloadSignInInitiate
from .types import CopilotPayloadSignOut
from .types import CopilotRequestConversationAgent
from .types import CopilotUserDefinedPromptTemplates
from .types import T_Callable
from .ui import ViewCompletionManager
from .ui import ViewPanelCompletionManager
from .ui import WindowConversationManager
from .utils import find_index_by_key_value
from .utils import find_view_by_id
from .utils import find_window_by_id
from .utils import get_session_setting
from .utils import message_dialog
from .utils import mutable_view
from .utils import ok_cancel_dialog
from .utils import status_message
from abc import ABC
from collections.abc import Callable
from functools import partial, wraps
from functools import partial
from functools import wraps
from LSP.plugin import Request
from LSP.plugin import Session
from LSP.plugin.core.registry import LspTextCommand
from LSP.plugin.core.registry import LspWindowCommand
from LSP.plugin.core.url import filename_to_uri
from lsp_utils.helpers import rmtree_ex
from pathlib import Path
from typing import Any, Literal, Sequence, cast

from typing import Any
from typing import cast
from typing import Literal
from typing import Sequence
import json
import os
import sublime
import sublime_plugin
from LSP.plugin import Request, Session
from LSP.plugin.core.registry import LspTextCommand, LspWindowCommand
from LSP.plugin.core.url import filename_to_uri
from lsp_utils.helpers import rmtree_ex

from .client import CopilotPlugin
from .constants import (
COPILOT_OUTPUT_PANEL_PREFIX,
PACKAGE_NAME,
REQ_CHECK_STATUS,
REQ_CONVERSATION_AGENTS,
REQ_CONVERSATION_CREATE,
REQ_CONVERSATION_DESTROY,
REQ_CONVERSATION_PRECONDITIONS,
REQ_CONVERSATION_RATING,
REQ_CONVERSATION_TEMPLATES,
REQ_CONVERSATION_TURN,
REQ_CONVERSATION_TURN_DELETE,
REQ_FILE_CHECK_STATUS,
REQ_GET_PANEL_COMPLETIONS,
REQ_GET_PROMPT,
REQ_GET_VERSION,
REQ_NOTIFY_ACCEPTED,
REQ_NOTIFY_REJECTED,
REQ_SIGN_IN_CONFIRM,
REQ_SIGN_IN_INITIATE,
REQ_SIGN_IN_WITH_GITHUB_TOKEN,
REQ_SIGN_OUT,
)
from .decorators import must_be_active_view
from .helpers import (
GithubInfo,
prepare_completion_request_doc,
prepare_conversation_turn_request,
preprocess_chat_message,
preprocess_message_for_html,
)
from .log import log_info
from .types import (
CopilotConversationDebugTemplates,
CopilotPayloadConversationCreate,
CopilotPayloadConversationPreconditions,
CopilotPayloadConversationTemplate,
CopilotPayloadFileStatus,
CopilotPayloadGetVersion,
CopilotPayloadNotifyAccepted,
CopilotPayloadNotifyRejected,
CopilotPayloadPanelCompletionSolutionCount,
CopilotPayloadSignInConfirm,
CopilotPayloadSignInInitiate,
CopilotPayloadSignOut,
CopilotRequestConversationAgent,
CopilotUserDefinedPromptTemplates,
T_Callable,
)
from .ui import ViewCompletionManager, ViewPanelCompletionManager, WindowConversationManager
from .utils import (
find_index_by_key_value,
find_view_by_id,
find_window_by_id,
get_session_setting,
message_dialog,
mutable_view,
ok_cancel_dialog,
status_message,
)
import uuid

REQUIRE_NOTHING = 0
REQUIRE_SIGN_IN = 1 << 0
Expand Down
11 changes: 6 additions & 5 deletions plugin/decorators.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from functools import wraps
from typing import Any, Callable, cast
from __future__ import annotations

from .types import T_Callable
from .utils import (
is_active_view,
)
from .utils import is_active_view
from functools import wraps
from typing import Any
from typing import Callable
from typing import cast


def must_be_active_view(*, failed_return: Any = None) -> Callable[[T_Callable], T_Callable]:
Expand Down
Loading
Loading