-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for latest ruby-lsp changes #301
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,10 @@ def initialize | |
@client = T.let(NullClient.new, RunnerClient) | ||
end | ||
|
||
sig { override.params(message_queue: Thread::Queue).void } | ||
def activate(message_queue) | ||
$stderr.puts("Activating Ruby LSP Rails addon v#{VERSION}") | ||
sig { override.params(global_state: GlobalState, message_queue: Thread::Queue).void } | ||
def activate(global_state, message_queue) | ||
@global_state = T.let(global_state, T.nilable(RubyLsp::GlobalState)) | ||
$stderr.puts("Activating Ruby LSP Rails addon v#{VERSION}") unless ENV["RAILS_ENV"] == "test" | ||
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient | ||
Thread.new { @client = RunnerClient.create_client } | ||
end | ||
|
@@ -53,11 +54,11 @@ def create_code_lens_listener(response_builder, uri, dispatcher) | |
override.params( | ||
response_builder: ResponseBuilders::Hover, | ||
nesting: T::Array[String], | ||
index: RubyIndexer::Index, | ||
dispatcher: Prism::Dispatcher, | ||
).void | ||
end | ||
def create_hover_listener(response_builder, nesting, index, dispatcher) | ||
def create_hover_listener(response_builder, nesting, dispatcher) | ||
index = T.must(@global_state).index | ||
Hover.new(@client, response_builder, nesting, index, dispatcher) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can follow Ruby LSP on passing the global state into listeners instead of index? FWIW, I'll need to do it for CodeLens in order to fix the duplicated test code lens issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 updated |
||
end | ||
|
||
|
@@ -76,11 +77,11 @@ def create_document_symbol_listener(response_builder, dispatcher) | |
response_builder: ResponseBuilders::CollectionResponseBuilder[Interface::Location], | ||
uri: URI::Generic, | ||
nesting: T::Array[String], | ||
index: RubyIndexer::Index, | ||
dispatcher: Prism::Dispatcher, | ||
).void | ||
end | ||
def create_definition_listener(response_builder, uri, nesting, index, dispatcher) | ||
def create_definition_listener(response_builder, uri, nesting, dispatcher) | ||
index = T.must(@global_state).index | ||
Definition.new(response_builder, nesting, index, dispatcher) | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these stderr silencing changes are not required for bumping Ruby LSP? I also remember @vinistock proposed a better way to handle these messages. Should we handle these in a more sophisticated way in a separate PR instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a bit tricky, I've removed the conditionals for now and we can address in a separate PR.