Skip to content

Commit c1ee8dd

Browse files
committed
WIP
1 parent b47335b commit c1ee8dd

File tree

8 files changed

+732
-604
lines changed

8 files changed

+732
-604
lines changed

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do
2525
gem "tzinfo"
2626
gem "tzinfo-data"
2727
end
28+
29+
gem "ruby-lsp", github: "Shopify/ruby-lsp", branch: "add-on-client-server-framework"

Gemfile.lock

+19-18
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ GIT
66
rdoc (6.6.3.1)
77
psych (>= 4.0.0)
88

9+
GIT
10+
remote: https://github.com/Shopify/ruby-lsp.git
11+
revision: dcb22575770cb200e812bdc0355805a6078d4069
12+
branch: add-on-client-server-framework
13+
specs:
14+
ruby-lsp (0.17.18)
15+
language_server-protocol (~> 3.17.0)
16+
prism (~> 1.0)
17+
rbs (>= 3, < 4)
18+
sorbet-runtime (>= 0.5.10782)
19+
920
PATH
1021
remote: .
1122
specs:
@@ -118,7 +129,7 @@ GEM
118129
reline (>= 0.4.2)
119130
json (2.7.2)
120131
language_server-protocol (3.17.0.3)
121-
logger (1.6.0)
132+
logger (1.6.1)
122133
loofah (2.22.0)
123134
crass (~> 1.0.2)
124135
nokogiri (>= 1.12.0)
@@ -146,8 +157,6 @@ GEM
146157
nio4r (2.7.3)
147158
nokogiri (1.16.5-arm64-darwin)
148159
racc (~> 1.4)
149-
nokogiri (1.16.5-x64-mingw-ucrt)
150-
racc (~> 1.4)
151160
nokogiri (1.16.5-x86_64-darwin)
152161
racc (~> 1.4)
153162
nokogiri (1.16.5-x86_64-linux)
@@ -156,7 +165,7 @@ GEM
156165
parser (3.3.1.0)
157166
ast (~> 2.4.1)
158167
racc
159-
prism (0.30.0)
168+
prism (1.0.0)
160169
psych (5.1.2)
161170
stringio
162171
public_suffix (5.0.5)
@@ -202,10 +211,10 @@ GEM
202211
zeitwerk (~> 2.6)
203212
rainbow (3.1.1)
204213
rake (13.2.1)
205-
rbi (0.1.13)
206-
prism (>= 0.18.0, < 1.0.0)
214+
rbi (0.2.0)
215+
prism (~> 1.0)
207216
sorbet-runtime (>= 0.5.9204)
208-
rbs (3.5.2)
217+
rbs (3.5.3)
209218
logger
210219
regexp_parser (2.9.0)
211220
reline (0.5.7)
@@ -234,11 +243,6 @@ GEM
234243
rubocop (~> 1.51)
235244
rubocop-sorbet (0.8.3)
236245
rubocop (>= 0.90.0)
237-
ruby-lsp (0.17.12)
238-
language_server-protocol (~> 3.17.0)
239-
prism (>= 0.29.0, < 0.31)
240-
rbs (>= 3, < 4)
241-
sorbet-runtime (>= 0.5.10782)
242246
ruby-progressbar (1.13.0)
243247
ruby2_keywords (0.0.5)
244248
sorbet (0.5.11406)
@@ -255,16 +259,15 @@ GEM
255259
sorbet-static-and-runtime (>= 0.5.10187)
256260
thor (>= 0.19.2)
257261
sqlite3 (1.7.3-arm64-darwin)
258-
sqlite3 (1.7.3-x64-mingw-ucrt)
259262
sqlite3 (1.7.3-x86_64-darwin)
260263
sqlite3 (1.7.3-x86_64-linux)
261264
stringio (3.1.0)
262265
strscan (3.1.0)
263-
tapioca (0.13.3)
266+
tapioca (0.16.2)
264267
bundler (>= 2.2.25)
265268
netrc (>= 0.11.0)
266269
parallel (>= 1.21.0)
267-
rbi (>= 0.1.4, < 0.2)
270+
rbi (~> 0.2)
268271
sorbet-static-and-runtime (>= 0.5.11087)
269272
spoom (>= 1.2.0)
270273
thor (>= 1.2.0)
@@ -273,8 +276,6 @@ GEM
273276
timeout (0.4.1)
274277
tzinfo (2.0.6)
275278
concurrent-ruby (~> 1.0)
276-
tzinfo-data (1.2024.1)
277-
tzinfo (>= 1.0.0)
278279
unicode-display_width (2.5.0)
279280
webmock (3.23.1)
280281
addressable (>= 2.8.0)
@@ -292,7 +293,6 @@ GEM
292293

293294
PLATFORMS
294295
arm64-darwin
295-
x64-mingw-ucrt
296296
x86_64-darwin
297297
x86_64-linux
298298

@@ -307,6 +307,7 @@ DEPENDENCIES
307307
rubocop-rake (~> 0.6.0)
308308
rubocop-shopify (~> 2.15)
309309
rubocop-sorbet (~> 0.8)
310+
ruby-lsp!
310311
ruby-lsp-rails!
311312
sorbet-static-and-runtime
312313
sqlite3 (< 2)

lib/ruby_lsp/ruby_lsp_rails/addon.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def initialize
2626

2727
# We first initialize the client as a NullClient, so that we can start the server in a background thread. Until
2828
# the real client is initialized, features that depend on it will not be blocked by using the NullClient
29-
@rails_runner_client = T.let(NullClient.new, RunnerClient)
29+
@rails_runner_client = T.let(NullClient.new(self), RunnerClient)
3030
@global_state = T.let(nil, T.nilable(GlobalState))
3131
end
3232

@@ -36,9 +36,9 @@ def initialize
3636
sig { override.params(global_state: GlobalState, message_queue: Thread::Queue).void }
3737
def activate(global_state, message_queue)
3838
@global_state = global_state
39-
$stderr.puts("Activating Ruby LSP Rails addon v#{VERSION}")
39+
$stderr.puts("Activating Ruby LSP Rails addon v#{VERSION}") unless ENV["RAILS_ENV"] == "test"
4040
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
41-
Thread.new { @rails_runner_client = RunnerClient.create_client }
41+
Thread.new { @rails_runner_client = RunnerClient.create_client(self) }
4242
register_additional_file_watchers(global_state: global_state, message_queue: message_queue)
4343

4444
@global_state.index.register_enhancement(IndexingEnhancement.new)

0 commit comments

Comments
 (0)