-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.py
38 lines (29 loc) · 1.11 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
from LSP.plugin.core.typing import Dict
from lsp_utils.pip_client_handler import PipClientHandler
import os
import sublime
class Jedilsp(PipClientHandler):
package_name = __package__
requirements_txt_path = "requirements.txt"
server_filename = "jedi-language-server"
# --- PipClientHandler handlers ------------------------------------------------------------------------------------
@classmethod
def get_python_binary(cls) -> str:
settings = sublime.load_settings("{}.sublime-settings".format(cls.package_name))
python_binary = settings.get("python_binary")
if python_binary and isinstance(python_binary, str):
return python_binary
return super().get_python_binary()
@classmethod
def get_additional_variables(cls) -> Dict[str, str]:
variables = super().get_additional_variables()
variables.update(
{
"sublime_py_files_dir": os.path.dirname(sublime.__file__),
}
)
return variables
def plugin_loaded() -> None:
Jedilsp.setup()
def plugin_unloaded() -> None:
Jedilsp.cleanup()