19
19
from multilspy .lsp_protocol_handler .lsp_types import InitializeParams
20
20
from multilspy .multilspy_config import MultilspyConfig
21
21
from multilspy .multilspy_utils import FileUtils
22
- from multilspy .multilspy_utils import PlatformUtils
22
+ from multilspy .multilspy_utils import PlatformUtils , PlatformId
23
23
24
24
25
25
class Solargraph (LanguageServer ):
@@ -48,6 +48,11 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
48
48
Setup runtime dependencies for Solargraph.
49
49
"""
50
50
platform_id = PlatformUtils .get_platform_id ()
51
+ cat_cmd = "cat"
52
+ which_cmd = "which"
53
+ if platform_id in [PlatformId .WIN_x64 , PlatformId .WIN_arm64 , PlatformId .WIN_x86 ]:
54
+ cat_cmd = "type"
55
+ which_cmd = "where"
51
56
52
57
with open (os .path .join (os .path .dirname (__file__ ), "runtime_dependencies.json" ), "r" ) as f :
53
58
d = json .load (f )
@@ -57,7 +62,7 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
57
62
58
63
# Check if Ruby is installed
59
64
try :
60
- result = subprocess .run (["cat" , ".ruby-version" ], capture_output = True , cwd = repository_root_path )
65
+ result = subprocess .run ([cat_cmd , ".ruby-version" ], capture_output = True , cwd = repository_root_path )
61
66
expected_ruby_version = result .stdout .strip ()
62
67
result = subprocess .run (["ruby" , "--version" ], check = True , capture_output = True , cwd = repository_root_path )
63
68
actual_ruby_version = result .stdout .strip ()
@@ -80,7 +85,7 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
80
85
81
86
# Get the solargraph executable path
82
87
try :
83
- result = subprocess .run (["which" , "solargraph" ], check = True , capture_output = True , text = True , cwd = repository_root_path )
88
+ result = subprocess .run ([which_cmd , "solargraph" ], check = True , capture_output = True , text = True , cwd = repository_root_path )
84
89
executeable_path = result .stdout .strip ()
85
90
86
91
if not os .path .exists (executeable_path ):
0 commit comments