File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed
lib/ruby_lsp/ruby_lsp_rails Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 7
7
module RubyLsp
8
8
module Rails
9
9
class RunnerClient
10
+ @instance = T . let ( nil , T . nilable ( RunnerClient ) )
11
+
10
12
class << self
11
13
extend T ::Sig
12
14
15
+ sig { returns ( T . nilable ( RunnerClient ) ) }
16
+ attr_reader :instance
17
+
13
18
sig { returns ( RunnerClient ) }
14
19
def create_client
15
20
if File . exist? ( "bin/rails" )
16
- new
21
+ @instance = new
17
22
else
18
23
$stderr. puts ( <<~MSG )
19
24
Ruby LSP Rails failed to locate bin/rails in the current directory: #{ Dir . pwd } "
20
25
MSG
21
26
$stderr. puts ( "Server dependent features will not be available" )
22
- NullClient . new
27
+ @instance = NullClient . new
23
28
end
24
29
rescue Errno ::ENOENT , StandardError => e # rubocop:disable Lint/ShadowedException
25
30
$stderr. puts ( "Ruby LSP Rails failed to initialize server: #{ e . message } \n #{ e . backtrace &.join ( "\n " ) } " )
26
31
$stderr. puts ( "Server dependent features will not be available" )
27
- NullClient . new
32
+ @instance = NullClient . new
28
33
end
29
34
end
30
35
@@ -169,6 +174,22 @@ def stopped?
169
174
[ @stdin , @stdout , @stderr ] . all? ( &:closed? ) && !@wait_thread . alive?
170
175
end
171
176
177
+ sig do
178
+ params (
179
+ server_addon_name : String ,
180
+ request_name : String ,
181
+ params : T . nilable ( T ::Hash [ Symbol , T . untyped ] )
182
+ ) . returns ( T . nilable ( T ::Hash [ Symbol , T . untyped ] ) )
183
+ end
184
+ def make_addon_request ( server_addon_name , request_name , **params )
185
+ make_request (
186
+ "server_addon/delegate" ,
187
+ server_addon_name :,
188
+ request_name :,
189
+ **params
190
+ )
191
+ end
192
+
172
193
sig do
173
194
params (
174
195
request : String ,
You can’t perform that action at this time.
0 commit comments