1919from multilspy .lsp_protocol_handler .lsp_types import InitializeParams
2020from multilspy .multilspy_config import MultilspyConfig
2121from multilspy .multilspy_utils import FileUtils
22- from multilspy .multilspy_utils import PlatformUtils
22+ from multilspy .multilspy_utils import PlatformUtils , PlatformId
2323
2424
2525class Solargraph (LanguageServer ):
@@ -48,6 +48,11 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
4848 Setup runtime dependencies for Solargraph.
4949 """
5050 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"
5156
5257 with open (os .path .join (os .path .dirname (__file__ ), "runtime_dependencies.json" ), "r" ) as f :
5358 d = json .load (f )
@@ -57,7 +62,7 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
5762
5863 # Check if Ruby is installed
5964 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 )
6166 expected_ruby_version = result .stdout .strip ()
6267 result = subprocess .run (["ruby" , "--version" ], check = True , capture_output = True , cwd = repository_root_path )
6368 actual_ruby_version = result .stdout .strip ()
@@ -80,7 +85,7 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
8085
8186 # Get the solargraph executable path
8287 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 )
8489 executeable_path = result .stdout .strip ()
8590
8691 if not os .path .exists (executeable_path ):
0 commit comments