@@ -27,6 +27,9 @@ def initialize
27
27
# The messages queue includes requests and notifications to be sent to the client
28
28
@message_queue = T . let ( Thread ::Queue . new , Thread ::Queue )
29
29
30
+ # The executor is responsible for executing requests
31
+ @executor = T . let ( Executor . new ( @store , @message_queue ) , Executor )
32
+
30
33
# Create a thread to watch the messages queue and send them to the client
31
34
@message_dispatcher = T . let (
32
35
Thread . new do
@@ -62,7 +65,7 @@ def start
62
65
@reader . read do |request |
63
66
case request [ :method ]
64
67
when "initialize" , "initialized" , "textDocument/didOpen" , "textDocument/didClose" , "textDocument/didChange"
65
- result = Executor . new ( @store , @message_queue ) . execute ( request )
68
+ result = @executor . execute ( request )
66
69
finalize_request ( result , request )
67
70
when "$/cancelRequest"
68
71
# Cancel the job if it's still in the queue
@@ -126,7 +129,7 @@ def new_worker
126
129
# We need to return nil to the client even if the request was cancelled
127
130
Result . new ( response : nil )
128
131
else
129
- Executor . new ( @store , @message_queue ) . execute ( request )
132
+ @executor . execute ( request )
130
133
end
131
134
132
135
finalize_request ( result , request )
0 commit comments