diff --git a/lib/ruby_lsp/ruby_lsp_rails/addon.rb b/lib/ruby_lsp/ruby_lsp_rails/addon.rb index 069b5f03..3b0bb80e 100644 --- a/lib/ruby_lsp/ruby_lsp_rails/addon.rb +++ b/lib/ruby_lsp/ruby_lsp_rails/addon.rb @@ -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 } diff --git a/test/ruby_lsp_rails/definition_test.rb b/test/ruby_lsp_rails/definition_test.rb index 169f3248..d3261e3e 100644 --- a/test/ruby_lsp_rails/definition_test.rb +++ b/test/ruby_lsp_rails/definition_test.rb @@ -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",