Skip to content

Commit

Permalink
fix: package control can be an optional dependency (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardroche authored Aug 15, 2024
1 parent 7d77b06 commit e0f4692
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions st3/lsp_utils/generic_client_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e0f4692

Please sign in to comment.