From e0f4692a0e91df234b4a37730d870dab7d8cc64d Mon Sep 17 00:00:00 2001 From: Gerard Roche Date: Thu, 15 Aug 2024 10:18:34 +0000 Subject: [PATCH] fix: package control can be an optional dependency (#123) --- st3/lsp_utils/generic_client_handler.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/st3/lsp_utils/generic_client_handler.py b/st3/lsp_utils/generic_client_handler.py index 85c625f..4372f23 100644 --- a/st3/lsp_utils/generic_client_handler.py +++ b/st3/lsp_utils/generic_client_handler.py @@ -7,7 +7,6 @@ from LSP.plugin import DottedDict from LSP.plugin import WorkspaceFolder from LSP.plugin.core.typing import Any, Dict, List, Optional, Tuple -from package_control import events # type: ignore import os import sublime @@ -46,8 +45,13 @@ def run_async() -> None: if os.path.isdir(cls.package_storage()): rmtree_ex(cls.package_storage()) - if events.remove(cls.package_name): - sublime.set_timeout_async(run_async, 1000) + try: + from package_control import events # type: ignore + if events.remove(cls.package_name): + sublime.set_timeout_async(run_async, 1000) + except ImportError: + pass # Package Control is not required. + super().cleanup() @classmethod