forked from microsoft/multilspy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultilspy_config.py
46 lines (40 loc) · 961 Bytes
/
multilspy_config.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
"""
Configuration parameters for Multilspy.
"""
from enum import Enum
from dataclasses import dataclass
class Language(str, Enum):
"""
Possible languages with Multilspy.
"""
CSHARP = "csharp"
PYTHON = "python"
RUST = "rust"
JAVA = "java"
KOTLIN = "kotlin"
TYPESCRIPT = "typescript"
JAVASCRIPT = "javascript"
GO = "go"
RUBY = "ruby"
DART = "dart"
CPP = "cpp"
def __str__(self) -> str:
return self.value
@dataclass
class MultilspyConfig:
"""
Configuration parameters
"""
code_language: Language
trace_lsp_communication: bool = False
start_independent_lsp_process: bool = True
@classmethod
def from_dict(cls, env: dict):
"""
Create a MultilspyConfig instance from a dictionary
"""
import inspect
return cls(**{
k: v for k, v in env.items()
if k in inspect.signature(cls).parameters
})