-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplugin.py
50 lines (37 loc) · 1.35 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sublime
from lsp_utils import GenericClientHandler, ServerResourceInterface
from LSP.plugin.core.typing import Optional
from .server_zip_resource import ServerZipResource
SERVER_VERSION = "0.26.4"
SERVER_URL = "https://github.com/elixir-lsp/elixir-ls/releases/download/v0.26.4/elixir-ls-v0.26.4.zip"
SERVER_SHA256 = "26668132879efc47f5c6aef0bf7113d403bf52dc1aa99b5c58a94b46ebb63169"
SERVER_EXECUTABLES = ["language_server.sh", "launch.sh"]
BINARY_PATH = (
"language_server.bat" if sublime.platform() == "windows" else "language_server.sh"
)
def plugin_loaded() -> None:
LspElixirPlugin.setup()
def plugin_unloaded() -> None:
LspElixirPlugin.cleanup()
class LspElixirPlugin(GenericClientHandler):
package_name = __package__
__server = None
@classmethod
def get_displayed_name(cls) -> str:
return "lsp-elixir"
@classmethod
def manages_server(cls) -> bool:
return True
@classmethod
def get_server(cls) -> Optional[ServerResourceInterface]:
if not cls.__server:
cls.__server = ServerZipResource(
cls.storage_path(),
cls.package_name,
BINARY_PATH,
SERVER_URL,
SERVER_VERSION,
asset_hash=SERVER_SHA256,
executables=SERVER_EXECUTABLES,
)
return cls.__server