@@ -27,22 +27,18 @@ def initialize
27
27
# We first initialize the client as a NullClient, so that we can start the server in a background thread. Until
28
28
# the real client is initialized, features that depend on it will not be blocked by using the NullClient
29
29
@client = T . let ( NullClient . new , RunnerClient )
30
+ @global_state = T . let ( nil , T . nilable ( GlobalState ) )
30
31
end
31
32
32
33
sig { override . params ( global_state : GlobalState , message_queue : Thread ::Queue ) . void }
33
34
def activate ( global_state , message_queue )
34
- @global_state = T . let ( global_state , T . nilable ( RubyLsp :: GlobalState ) )
35
+ @global_state = global_state
35
36
$stderr. puts ( "Activating Ruby LSP Rails addon v#{ VERSION } " )
36
37
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
37
- Thread . new do
38
- @client = RunnerClient . create_client
39
- # TODO: move rails_runner_stdin to be in ruby-lsp instead of ivar_get
40
- # (or maybe somet other way, probably not in global state)
41
- @global_state . instance_variable_set ( :@rails_runner_stdin , @client . stdin )
42
- end
38
+ Thread . new { @client = RunnerClient . create_client ( global_state ) }
43
39
register_additional_file_watchers ( global_state : global_state , message_queue : message_queue )
44
40
45
- T . must ( @global_state ) . index . register_enhancement ( IndexingEnhancement . new )
41
+ @global_state . index . register_enhancement ( IndexingEnhancement . new )
46
42
end
47
43
48
44
sig { override . void }
0 commit comments