Skip to content

Commit faa8069

Browse files
committed
DEBUG
1 parent f25aac9 commit faa8069

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ source "https://rubygems.org"
44

55
gemspec
66

7-
gem "bundler", "~> 4.0.0.beta2"
7+
gem "bundler", "~> 4.0.0"
88
gem "minitest", "~> 5.25"
99
gem "test-unit", require: false
1010

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ PLATFORMS
135135
x86_64-linux
136136

137137
DEPENDENCIES
138-
bundler (~> 4.0.0.beta2)
138+
bundler (~> 4.0.0)
139139
debug (~> 1.9)
140140
minitest (~> 5.25)
141141
mocha (~> 2.3)
@@ -212,4 +212,4 @@ CHECKSUMS
212212
yard-sorbet (0.9.0) sha256=03d1aa461b9e9c82b886919a13aa3e09fcf4d1852239d2967ed97e92723ffe21
213213

214214
BUNDLED WITH
215-
4.0.0.beta2
215+
4.0.0

test/integration_test.rb

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_uses_same_bundler_version_as_main_app
126126
stringio
127127
128128
BUNDLED WITH
129-
4.0.0.beta1
129+
4.0.0
130130
LOCKFILE
131131
File.write(File.join(dir, "Gemfile.lock"), lockfile_contents)
132132

@@ -140,7 +140,7 @@ def test_uses_same_bundler_version_as_main_app
140140
launch(dir, "ruby-lsp")
141141
end
142142

143-
assert_match(/BUNDLED WITH\n\s*4.0.0.beta1/, File.read(File.join(dir, ".ruby-lsp", "Gemfile.lock")))
143+
assert_match(/BUNDLED WITH\n\s*4.0.0/, File.read(File.join(dir, ".ruby-lsp", "Gemfile.lock")))
144144
end
145145
end
146146

@@ -165,7 +165,7 @@ def test_does_not_use_custom_binstubs_if_they_are_in_the_path
165165
stringio
166166
167167
BUNDLED WITH
168-
4.0.0.beta1
168+
4.0.0
169169
LOCKFILE
170170
File.write(File.join(dir, "Gemfile.lock"), lockfile_contents)
171171

@@ -187,7 +187,7 @@ def test_does_not_use_custom_binstubs_if_they_are_in_the_path
187187
launch(dir, "ruby-lsp", { "PATH" => "#{bin_path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" })
188188
end
189189

190-
assert_match(/BUNDLED WITH\n\s*4.0.0.beta1/, File.read(File.join(dir, ".ruby-lsp", "Gemfile.lock")))
190+
assert_match(/BUNDLED WITH\n\s*4.0.0/, File.read(File.join(dir, ".ruby-lsp", "Gemfile.lock")))
191191
end
192192
end
193193

@@ -233,7 +233,7 @@ def test_launch_mode_with_full_bundle
233233
stringio
234234
235235
BUNDLED WITH
236-
2.5.7
236+
4.0.0
237237
LOCKFILE
238238
File.write(File.join(dir, "Gemfile.lock"), lockfile_contents)
239239

@@ -353,7 +353,7 @@ def test_launch_mode_update_does_not_modify_main_lockfile
353353
ruby-lsp-rails
354354
355355
BUNDLED WITH
356-
4.0.0.beta1
356+
4.0.0
357357
LOCKFILE
358358
File.write(File.join(dir, "Gemfile.lock"), lockfile_contents)
359359

@@ -421,7 +421,7 @@ def test_launching_an_older_server_version
421421
in_temp_dir do |dir|
422422
File.write(File.join(dir, "Gemfile"), <<~RUBY)
423423
source "https://rubygems.org"
424-
gem "ruby-lsp", "0.23.0"
424+
gem "ruby-lsp", "0.24.0"
425425
RUBY
426426

427427
Bundler.with_unbundled_env do
@@ -437,21 +437,10 @@ def test_launching_an_older_server_version
437437
private
438438

439439
def launch(workspace_path, exec = "ruby-lsp-launcher", extra_env = {})
440-
specification = Gem::Specification.find_by_name("ruby-lsp")
441-
paths = [specification.full_gem_path]
442-
paths.concat(specification.dependencies.filter_map { |dep| dep.to_spec&.full_gem_path })
443-
444-
load_path = $LOAD_PATH.filter_map do |path|
445-
next unless paths.any? { |gem_path| path.start_with?(gem_path) } || !path.start_with?(@bundle_path)
446-
447-
["-I", File.expand_path(path)]
448-
end.uniq.flatten
449-
450440
stdin, stdout, stderr, wait_thr = Open3 #: as untyped
451441
.popen3(
452442
extra_env,
453443
Gem.ruby,
454-
*load_path,
455444
File.join(__dir__, "..", "exe", exec),
456445
)
457446
stdin.sync = true
@@ -472,9 +461,9 @@ def launch(workspace_path, exec = "ruby-lsp-launcher", extra_env = {})
472461
})
473462

474463
# First message is the log of initializing Ruby LSP
475-
read_message(stdout)
464+
read_message(stdout, stderr)
476465
# Verify that initialization didn't fail
477-
initialize_response = read_message(stdout)
466+
initialize_response = read_message(stdout, stderr)
478467
refute(initialize_response[:error], initialize_response.dig(:error, :message))
479468

480469
send_message(stdin, { id: 2, method: "shutdown" })
@@ -504,8 +493,10 @@ def send_message(stdin, message)
504493
stdin.flush
505494
end
506495

507-
def read_message(stdout)
496+
def read_message(stdout, stderr)
508497
headers = stdout.gets("\r\n\r\n")
498+
flunk(stderr.read) unless headers
499+
509500
length = headers[/Content-Length: (\d+)/i, 1].to_i
510501
JSON.parse(stdout.read(length), symbolize_names: true)
511502
end

0 commit comments

Comments
 (0)