Closed
Conversation
36ea722 to
d997d70
Compare
145b51d to
dcb2257
Compare
This commit introduces two new classes to enhance the addon framework: 1. ProcessClient: Manages communication with addon servers, handling initialization, message sending/receiving, and shutdown. 2. ProcessServer: Provides a base class for addon servers to handle requests and responses. These classes facilitate better separation of concerns and provide a structured approach for addons to communicate with the Ruby LSP server.
dcb2257 to
d578615
Compare
andyw8
reviewed
Oct 11, 2024
| # typed: strict | ||
| # frozen_string_literal: true | ||
|
|
||
| require "sorbet-runtime" |
Contributor
There was a problem hiding this comment.
We had some issues in the past when requiring sorbet-runtime within the Rails side. I can't recall the exact cause, but we might need to be wary of that or do some extra checking.
| @running = false | ||
| { result: {} } | ||
| else | ||
| VOID |
Contributor
There was a problem hiding this comment.
We shouldn't need the VOID stuff any more now that Shopify/ruby-lsp-rails#453 is merged.
Member
Author
|
FYI, I'll update this after Tapioca LSP is merged. |
Contributor
|
This pull request is being marked as stale because there was no activity in the last 2 months |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The client/server architecture of
ruby-lsp-railsto a large degree can be adopted by many other addons too. For example, other web frameworks, like Hanami, can also use it to provide runtime information. And if we extract the base client/server implementation intoruby-lsp, it'll make such applications easier to implement.Also, through such extraction we can standardize things like:
And that will make
ruby-lsp-railseasier to maintain and understand as well.Draft PR from
ruby-lsp-rails: Shopify/ruby-lsp-rails#439Implementation
RubyLsp::Addon::ProcessClient|ProcessServerclasses. To use them, addons should requireruby_lsp/addon/process_clientin the client file andruby_lsp/addon/process_serverin the server file.processprefix with the hope to indicate that they're only needed when the addon needs to interact with another process.Automated Tests
I added a new
test/addon/process_client_server_test.rbwith a fake addon to test the client and server end-to-end.Manual Tests