Skip to content

Commit

Permalink
Fix thread handling (#356)
Browse files Browse the repository at this point in the history
Co-authored-by: Andy Waite <[email protected]>
  • Loading branch information
andyw8 and andyw8 authored May 1, 2024
1 parent c3f6141 commit 2a30aca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/ruby_lsp_rails/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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}")
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
Thread.new { @client = RunnerClient.create_client }.join
Thread.new { @client = RunnerClient.create_client }
end

sig { override.void }
Expand Down
2 changes: 2 additions & 0 deletions test/ruby_lsp_rails/definition_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def baz; end

def generate_definitions_for_source(source, position)
with_server(source) do |server, uri|
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@client).is_a?(NullClient)

server.process_message(
id: 1,
method: "textDocument/definition",
Expand Down

0 comments on commit 2a30aca

Please sign in to comment.