Merge pull request #389 from dragonfax/jstillwell/fix_solargraph

Solargraph (ruby): Use the framework provided by ruby gems to execute
This commit is contained in:
Michael Panchenko authored and GitHub committed 2025-08-02 12:23:58 +02:00
commit 2ef00a7e0d
1 file changed
+1 -13
+1 -13
View File
@@ -87,19 +87,7 @@ class Solargraph(SolidLanguageServer):
logger.log("Installing Solargraph...", logging.INFO)
subprocess.run(dependency["installCommand"].split(), check=True, capture_output=True, cwd=repository_root_path)
# Get the gem executable path directly
result = subprocess.run(["gem", "which", "solargraph"], check=True, capture_output=True, text=True, cwd=repository_root_path)
gem_path = result.stdout.strip()
bin_dir = os.path.join(os.path.dirname(os.path.dirname(gem_path)), "bin")
executable_path = os.path.join(bin_dir, "solargraph")
if not os.path.exists(executable_path):
raise RuntimeError(f"Solargraph executable not found at {executable_path}")
# Ensure the executable has the right permissions
os.chmod(executable_path, os.stat(executable_path).st_mode | stat.S_IEXEC)
return executable_path
return "gem exec solargraph"
except subprocess.CalledProcessError as e:
raise RuntimeError(f"Failed to check or install Solargraph. {e.stderr}") from e