Skip to content

Conversation

yashwanthatla
Copy link
Owner

@yashwanthatla yashwanthatla commented Jun 21, 2025

PR Summary

Add Ruby Language Support via Solargraph Integration

Overview

This PR adds support for the Ruby programming language to the multilspy framework by integrating the Solargraph language server.

Change Types

Type Description
Feature Add Ruby language support
Test Add test coverage for Ruby integration

Affected Modules

Module / File Change Description
multilspy/multilspy_config.py Added "RUBY" enum value to Language class
multilspy/language_server.py Integrated Ruby language support via Solargraph
multilspy/language_servers/solargraph/solargraph.py New file implementing Ruby language server
multilspy/test_sync_multilspy_ruby.py New test file for Ruby language server
multilspy/test_multilspy_ruby.py New test file for Ruby integration

Notes for Reviewers

  • The implementation uses Solargraph as the language server for Ruby
  • Tests cover document symbols, definitions, and references functionality

# Get the solargraph executable path
try:
result = subprocess.run([which_cmd, "solargraph"], check=True, capture_output=True, text=True, cwd=repository_root_path)
executeable_path = result.stdout.strip()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 Correctness Issue

Typo in variable name causes runtime error.

The variable 'executeable_path' has a typo and should be 'executable_path', which will cause inconsistency when referencing this variable later.

Current Code (Diff):

-             executeable_path = result.stdout.strip()
+             executable_path = result.stdout.strip()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
executeable_path = result.stdout.strip()
executable_path = result.stdout.strip()

🔄 Dependencies Affected

multilspy/language_servers/solargraph/solargraph.py

Function: Solargraph.setup_runtime_dependencies

Issue: Variable name mismatch in subsequent references

Suggestion: Fix all references to use the correct variable name

Current Code (Diff):

-             if not os.path.exists(executeable_path):
+             if not os.path.exists(executable_path):
-                 raise RuntimeError(f"Solargraph executable not found at {executeable_path}")
+                 raise RuntimeError(f"Solargraph executable not found at {executable_path}")
-             os.chmod(executeable_path, os.stat(executeable_path).st_mode | stat.S_IEXEC)
+             os.chmod(executable_path, os.stat(executable_path).st_mode | stat.S_IEXEC)

assert "registrations" in params
for registration in params["registrations"]:
if registration["method"] == "workspace/executeCommand":
self.initialize_searcher_command_available.set()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 Correctness Issue

Undefined class attribute usage.

The code attempts to use 'initialize_searcher_command_available' which is not defined in the class, causing a runtime AttributeError.

Current Code (Diff):

-                     self.initialize_searcher_command_available.set()
+                     if hasattr(self, 'initialize_searcher_command_available'):
+                         self.initialize_searcher_command_available.set()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.initialize_searcher_command_available.set()
if hasattr(self, 'initialize_searcher_command_available'):
self.initialize_searcher_command_available.set()

for registration in params["registrations"]:
if registration["method"] == "workspace/executeCommand":
self.initialize_searcher_command_available.set()
self.resolve_main_method_available.set()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 Correctness Issue

Undefined class attribute usage.

The code attempts to use 'resolve_main_method_available' which is not defined in the class, causing a runtime AttributeError.

Current Code (Diff):

-                     self.resolve_main_method_available.set()
+                     if hasattr(self, 'resolve_main_method_available'):
+                         self.resolve_main_method_available.set()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.resolve_main_method_available.set()
if hasattr(self, 'resolve_main_method_available'):
self.resolve_main_method_available.set()

# server -> client: {'jsonrpc': '2.0', 'method': 'language/status', 'params': {'type': 'ProjectStatus', 'message': 'OK'}}
# Before proceeding?
if params["type"] == "ServiceReady" and params["message"] == "ServiceReady":
self.service_ready_event.set()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 Correctness Issue

Undefined class attribute usage.

The code attempts to use 'service_ready_event' which is not defined in the class, causing a runtime AttributeError.

Current Code (Diff):

-                 self.service_ready_event.set()
+                 if hasattr(self, 'service_ready_event'):
+                     self.service_ready_event.set()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.service_ready_event.set()
if hasattr(self, 'service_ready_event'):
self.service_ready_event.set()

Comment on lines +187 to +188
self.server_ready.set()
await self.server_ready.wait()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 Correctness Issue

Potential deadlock in event handling.

Setting and immediately waiting on the same event ('server_ready') creates a deadlock as the event is never reset between operations.

Current Code (Diff):

-             self.server_ready.set()
-             await self.server_ready.wait()
+             # self.server_ready.set()
+             # await self.server_ready.wait()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.server_ready.set()
await self.server_ready.wait()
# self.server_ready.set()
# await self.server_ready.wait()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants