-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplugin.py
More file actions
50 lines (37 loc) · 1.34 KB
/
plugin.py
File metadata and controls
50 lines (37 loc) · 1.34 KB
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
from __future__ import annotations
import sublime
from lsp_utils import GenericClientHandler, ServerResourceInterface
from .server_zip_resource import ServerZipResource
SERVER_VERSION = "0.30.0"
SERVER_URL = "https://github.com/elixir-lsp/elixir-ls/releases/download/v0.30.0/elixir-ls-v0.30.0.zip"
SERVER_SHA256 = "924c3d44c9d04ba332e4613697ef0f91ff7a57c1205d4e9fcc1395bd0e69b042"
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 = str(__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) -> ServerResourceInterface | None:
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