diff --git a/plugin/__init__.py b/plugin/__init__.py index 1c899de..a9f7df7 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -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 diff --git a/plugin/client.py b/plugin/client.py index f86ed04..09ca31b 100644 --- a/plugin/client.py +++ b/plugin/client.py @@ -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 diff --git a/plugin/commands.py b/plugin/commands.py index 1dfcced..527baad 100644 --- a/plugin/commands.py +++ b/plugin/commands.py @@ -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 diff --git a/plugin/decorators.py b/plugin/decorators.py index 9578e63..1eb77ec 100644 --- a/plugin/decorators.py +++ b/plugin/decorators.py @@ -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]: diff --git a/plugin/helpers.py b/plugin/helpers.py index f371d01..d8c280a 100644 --- a/plugin/helpers.py +++ b/plugin/helpers.py @@ -1,46 +1,48 @@ from __future__ import annotations +from .constants import COPILOT_WINDOW_SETTINGS_PREFIX +from .constants import PACKAGE_NAME +from .log import log_error +from .settings import get_plugin_setting_dotted +from .types import CopilotConversationTemplates +from .types import CopilotDocType +from .types import CopilotGitHubWebSearch +from .types import CopilotPayloadCompletion +from .types import CopilotPayloadPanelSolution +from .types import CopilotRequestConversationTurn +from .types import CopilotRequestConversationTurnReference +from .types import CopilotUserDefinedPromptTemplates +from .utils import all_views +from .utils import all_windows +from .utils import drop_falsy +from .utils import erase_copilot_setting +from .utils import erase_copilot_view_setting +from .utils import get_copilot_setting +from .utils import get_project_relative_path +from .utils import get_view_language_id +from .utils import set_copilot_setting +from LSP.plugin.core.protocol import Position as LspPosition +from LSP.plugin.core.url import view_to_uri +from LSP.plugin.core.views import position_to_offset +from LSP.plugin.core.views import range_to_region +from LSP.plugin.core.views import region_to_range +from more_itertools import duplicates_everseen +from more_itertools import first_true +from operator import itemgetter +from pathlib import Path +from typing import Any +from typing import Callable +from typing import cast +from typing import Literal +from typing import Sequence +from wcmatch import glob import itertools import os import re -import threading -import time -from operator import itemgetter -from pathlib import Path -from typing import Any, Callable, Literal, Sequence, cast - import requests import sublime -from LSP.plugin.core.protocol import Position as LspPosition -from LSP.plugin.core.url import view_to_uri -from LSP.plugin.core.views import position_to_offset, range_to_region, region_to_range -from more_itertools import duplicates_everseen, first_true -from wcmatch import glob - -from .constants import COPILOT_WINDOW_SETTINGS_PREFIX, PACKAGE_NAME -from .log import log_error -from .settings import get_plugin_setting_dotted -from .types import ( - CopilotConversationTemplates, - CopilotDocType, - CopilotGitHubWebSearch, - CopilotPayloadCompletion, - CopilotPayloadPanelSolution, - CopilotRequestConversationTurn, - CopilotRequestConversationTurnReference, - CopilotUserDefinedPromptTemplates, -) -from .utils import ( - all_views, - all_windows, - drop_falsy, - erase_copilot_setting, - erase_copilot_view_setting, - get_copilot_setting, - get_project_relative_path, - get_view_language_id, - set_copilot_setting, -) +import threading +import time class ActivityIndicator: diff --git a/plugin/listeners.py b/plugin/listeners.py index 0e33b82..6dde412 100644 --- a/plugin/listeners.py +++ b/plugin/listeners.py @@ -1,22 +1,27 @@ from __future__ import annotations -import re -from collections.abc import Iterable -from typing import Any, final - -import sublime -import sublime_plugin -from typing_extensions import override -from watchdog.events import FileSystemEvent, FileSystemEventHandler -from watchdog.observers import Observer -from watchdog.observers.api import ObservedWatch - from .client import CopilotPlugin from .constants import PACKAGE_NAME from .decorators import must_be_active_view from .helpers import CopilotIgnore -from .ui import ViewCompletionManager, ViewPanelCompletionManager, WindowConversationManager -from .utils import all_windows, get_copilot_view_setting, get_session_setting, set_copilot_view_setting +from .ui import ViewCompletionManager +from .ui import ViewPanelCompletionManager +from .ui import WindowConversationManager +from .utils import all_windows +from .utils import get_copilot_view_setting +from .utils import get_session_setting +from .utils import set_copilot_view_setting +from collections.abc import Iterable +from typing import Any +from typing import final +from typing_extensions import override +from watchdog.events import FileSystemEvent +from watchdog.events import FileSystemEventHandler +from watchdog.observers import Observer +from watchdog.observers.api import ObservedWatch +import re +import sublime +import sublime_plugin class ViewEventListener(sublime_plugin.ViewEventListener): diff --git a/plugin/log.py b/plugin/log.py index a463713..ec5d4f6 100644 --- a/plugin/log.py +++ b/plugin/log.py @@ -1,11 +1,9 @@ from __future__ import annotations +from .constants import PACKAGE_NAME from typing import Any - import sublime -from .constants import PACKAGE_NAME - def log_debug(message: str) -> None: print(f"[{PACKAGE_NAME}][DEBUG] {message}") diff --git a/plugin/settings.py b/plugin/settings.py index 4706b9d..5eaa2ed 100644 --- a/plugin/settings.py +++ b/plugin/settings.py @@ -1,13 +1,11 @@ from __future__ import annotations +from .constants import PACKAGE_NAME from functools import lru_cache from typing import Any - import jmespath import sublime -from .constants import PACKAGE_NAME - @lru_cache def _compile_jmespath_expression(expression: str) -> jmespath.parser.ParsedResult: diff --git a/plugin/template.py b/plugin/template.py index f75777e..bcd855e 100644 --- a/plugin/template.py +++ b/plugin/template.py @@ -1,14 +1,12 @@ from __future__ import annotations +from .constants import PACKAGE_NAME +from .helpers import is_debug_mode from functools import lru_cache +from LSP.plugin.core.url import parse_uri from typing import Iterable - import jinja2 import sublime -from LSP.plugin.core.url import parse_uri - -from .constants import PACKAGE_NAME -from .helpers import is_debug_mode @lru_cache diff --git a/plugin/types.py b/plugin/types.py index 0c3a9d3..c538053 100644 --- a/plugin/types.py +++ b/plugin/types.py @@ -1,11 +1,15 @@ from __future__ import annotations from dataclasses import dataclass -from typing import Any, Callable, Literal, Tuple, TypedDict, TypeVar - from LSP.plugin.core.protocol import Position as LspPosition from LSP.plugin.core.protocol import Range as LspRange from LSP.plugin.core.typing import StrEnum +from typing import Any +from typing import Callable +from typing import Literal +from typing import Tuple +from typing import TypedDict +from typing import TypeVar T_Callable = TypeVar("T_Callable", bound=Callable[..., Any]) diff --git a/plugin/ui/chat.py b/plugin/ui/chat.py index 1e1ae4c..91f7ed0 100644 --- a/plugin/ui/chat.py +++ b/plugin/ui/chat.py @@ -1,16 +1,21 @@ from __future__ import annotations +from ..constants import COPILOT_WINDOW_CONVERSATION_SETTINGS_PREFIX +from ..helpers import GithubInfo +from ..helpers import preprocess_message_for_html +from ..template import load_resource_template +from ..types import CopilotPayloadConversationEntry +from ..types import CopilotPayloadConversationEntryTransformed +from ..types import StLayout +from ..utils import find_view_by_id +from ..utils import find_window_by_id +from ..utils import get_copilot_setting +from ..utils import remove_prefix +from ..utils import set_copilot_setting from typing import Callable - import mdpopups import sublime -from ..constants import COPILOT_WINDOW_CONVERSATION_SETTINGS_PREFIX -from ..helpers import GithubInfo, preprocess_message_for_html -from ..template import load_resource_template -from ..types import CopilotPayloadConversationEntry, CopilotPayloadConversationEntryTransformed, StLayout -from ..utils import find_view_by_id, find_window_by_id, get_copilot_setting, remove_prefix, set_copilot_setting - class WindowConversationManager: # --------------- # diff --git a/plugin/ui/completion.py b/plugin/ui/completion.py index 6b7c15f..93062b9 100644 --- a/plugin/ui/completion.py +++ b/plugin/ui/completion.py @@ -1,24 +1,21 @@ from __future__ import annotations -import html -import textwrap -from abc import ABC, abstractmethod +from ..template import load_resource_template +from ..types import CopilotPayloadCompletion +from ..utils import clamp +from ..utils import fix_completion_syntax_highlight +from ..utils import get_copilot_view_setting +from ..utils import get_view_language_id +from ..utils import is_active_view +from ..utils import set_copilot_view_setting +from abc import ABC +from abc import abstractmethod +from more_itertools import first_true from typing import Sequence - +import html import mdpopups import sublime -from more_itertools import first_true - -from ..template import load_resource_template -from ..types import CopilotPayloadCompletion -from ..utils import ( - clamp, - fix_completion_syntax_highlight, - get_copilot_view_setting, - get_view_language_id, - is_active_view, - set_copilot_view_setting, -) +import textwrap _view_to_phantom_set: dict[int, sublime.PhantomSet] = {} diff --git a/plugin/ui/panel_completion.py b/plugin/ui/panel_completion.py index 9cf0bfb..6c17b5b 100644 --- a/plugin/ui/panel_completion.py +++ b/plugin/ui/panel_completion.py @@ -1,23 +1,21 @@ from __future__ import annotations -import textwrap +from ..template import load_resource_template +from ..types import CopilotPayloadPanelSolution +from ..types import StLayout +from ..utils import all_views +from ..utils import find_view_by_id +from ..utils import fix_completion_syntax_highlight +from ..utils import get_copilot_view_setting +from ..utils import get_view_language_id +from ..utils import remove_prefix +from ..utils import set_copilot_view_setting from collections.abc import Iterable - +from more_itertools import first_true +from more_itertools import unique_everseen import mdpopups import sublime -from more_itertools import first_true, unique_everseen - -from ..template import load_resource_template -from ..types import CopilotPayloadPanelSolution, StLayout -from ..utils import ( - all_views, - find_view_by_id, - fix_completion_syntax_highlight, - get_copilot_view_setting, - get_view_language_id, - remove_prefix, - set_copilot_view_setting, -) +import textwrap class ViewPanelCompletionManager: diff --git a/plugin/utils.py b/plugin/utils.py index 90c66ca..a6897e4 100644 --- a/plugin/utils.py +++ b/plugin/utils.py @@ -1,28 +1,36 @@ from __future__ import annotations +from .constants import COPILOT_VIEW_SETTINGS_PREFIX +from .constants import PACKAGE_NAME +from .types import T_Callable +from collections.abc import Callable +from collections.abc import Generator +from collections.abc import Iterable +from functools import wraps +from LSP.plugin.core.sessions import Session +from LSP.plugin.core.types import basescope2languageid +from more_itertools import first +from more_itertools import first_true +from pathlib import Path +from typing import Any +from typing import cast +from typing import IO +from typing import Mapping +from typing import Sequence +from typing import TypeVar +from typing import Union import contextlib import gzip import io import os import re import shutil +import sublime import sys import tarfile import threading import urllib.request import zipfile -from collections.abc import Callable, Generator, Iterable -from functools import wraps -from pathlib import Path -from typing import IO, Any, Mapping, Sequence, TypeVar, Union, cast - -import sublime -from LSP.plugin.core.sessions import Session -from LSP.plugin.core.types import basescope2languageid -from more_itertools import first, first_true - -from .constants import COPILOT_VIEW_SETTINGS_PREFIX, PACKAGE_NAME -from .types import T_Callable _T = TypeVar("_T") _KT = TypeVar("_KT") diff --git a/plugin/version_manager.py b/plugin/version_manager.py index c2ec503..02966ad 100644 --- a/plugin/version_manager.py +++ b/plugin/version_manager.py @@ -1,13 +1,14 @@ from __future__ import annotations -import io -from pathlib import Path - -from LSP.plugin import AbstractPlugin - -from .constants import PACKAGE_NAME, PLATFORM_ARCH +from .constants import PACKAGE_NAME +from .constants import PLATFORM_ARCH from .log import log_info -from .utils import decompress_buffer, rmtree_ex, simple_urlopen +from .utils import decompress_buffer +from .utils import rmtree_ex +from .utils import simple_urlopen +from LSP.plugin import AbstractPlugin +from pathlib import Path +import io class VersionManager: diff --git a/pyproject.toml b/pyproject.toml index 05d34af..d213ab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,5 +87,15 @@ select = [ "UP", "FURB", "SIM", + "F401", ] ignore = ["E203", "SIM102", "SIM108"] +preview = true + +[tool.ruff.lint.isort] +case-sensitive = false +force-single-line = true +from-first = true +no-sections = true +order-by-type = false +required-imports = ["from __future__ import annotations"]