Skip to content

Commit 2a30aca

Browse files
authored
Fix thread handling (#356)
Co-authored-by: Andy Waite <[email protected]>
1 parent c3f6141 commit 2a30aca

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: lib/ruby_lsp/ruby_lsp_rails/addon.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def activate(global_state, message_queue)
3131
@global_state = T.let(global_state, T.nilable(RubyLsp::GlobalState))
3232
$stderr.puts("Activating Ruby LSP Rails addon v#{VERSION}")
3333
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
34-
Thread.new { @client = RunnerClient.create_client }.join
34+
Thread.new { @client = RunnerClient.create_client }
3535
end
3636

3737
sig { override.void }

Diff for: test/ruby_lsp_rails/definition_test.rb

+2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ def baz; end
124124

125125
def generate_definitions_for_source(source, position)
126126
with_server(source) do |server, uri|
127+
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@client).is_a?(NullClient)
128+
127129
server.process_message(
128130
id: 1,
129131
method: "textDocument/definition",

0 commit comments

Comments
 (0)