ruby-lsp 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0761510f35a450cb8ba4b2875dc50826abdc12c07158cd9ee442c863dae5292
4
- data.tar.gz: 7906c0f49b975b75f09c96e0d28222f344963eca363a6a08b29ba0aa697b2084
3
+ metadata.gz: dba33af47ce558162b73c39422465b451e4af9e835d9446ff90414de0f44fd66
4
+ data.tar.gz: fb9b769fceb2563b2392b6395cb65a17511e5dee9614d8158fb28c5bd5628843
5
5
  SHA512:
6
- metadata.gz: aaf45a911c54ce8a3e2e0051beb5941016b689a2e13bbbf2d438cda04ce315560d0af9f206cd2ee8bb136989dbd6863068c5d4c5d52d5b9372584beda7973815
7
- data.tar.gz: 828569fe84d0e0ff5cf714b194926c07f30ae58cc23bf8e31bed1aa3b930406c9670561631e8c7ff9f151d01a12dc321c3ca85979923dfb6e88023fa7cab1528
6
+ metadata.gz: 53b879df720b44940dc838245a174bebc08849d6673a9076b612df90a47036e69fdc367cc7e0dc3df934a762758e36cebea2d6c84e4b3e992023f2bf9056b14f
7
+ data.tar.gz: 65856714024b1329d693cc49eb3e846af1b7737dfd4f914ddb2b677ddada993cca65f81ec9447605325380aee2564930ee2401efc87e57f9d11e92600533d9ca
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.3
@@ -1,6 +1,7 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
+ require "sorbet-runtime"
4
5
  require "bundler"
5
6
  require "fileutils"
6
7
 
@@ -16,6 +17,14 @@ module RubyLsp
16
17
  def initialize(project_path)
17
18
  @project_path = project_path
18
19
  @dependencies = T.let(load_dependencies, T::Hash[String, T.untyped])
20
+ @custom_bundle_dependencies = T.let(
21
+ if File.exist?(".ruby-lsp/Gemfile.lock")
22
+ Bundler::LockfileParser.new(Bundler.read_file(".ruby-lsp/Gemfile.lock")).dependencies
23
+ else
24
+ {}
25
+ end,
26
+ T::Hash[String, T.untyped],
27
+ )
19
28
  end
20
29
 
21
30
  sig { void }
@@ -30,6 +39,11 @@ module RubyLsp
30
39
  # Do not setup a custom bundle if both `ruby-lsp` and `debug` are already in the Gemfile
31
40
  if @dependencies["ruby-lsp"] && @dependencies["debug"]
32
41
  warn("Ruby LSP> Skipping custom bundle setup since both `ruby-lsp` and `debug` are already in the Gemfile")
42
+
43
+ # If the user decided to add the `ruby-lsp` and `debug` to their Gemfile after having already run the Ruby LSP,
44
+ # then we need to remove the `.ruby-lsp` folder, otherwise we will run `bundle install` for the top level and
45
+ # try to execute the Ruby LSP using the custom bundle, which will fail since the gems are not installed there
46
+ FileUtils.rm_r(".ruby-lsp") if Dir.exist?(".ruby-lsp")
33
47
  run_bundle_install
34
48
  return
35
49
  end
@@ -111,7 +125,13 @@ module RubyLsp
111
125
  command << "BUNDLE_PATH=#{File.expand_path(path, Dir.pwd)} " if path
112
126
  command << "BUNDLE_GEMFILE=#{bundle_gemfile} " if bundle_gemfile
113
127
 
114
- if @dependencies["ruby-lsp"] && @dependencies["debug"]
128
+ # If both `ruby-lsp` and `debug` are already in the Gemfile, then we shouldn't try to upgrade them or else we'll
129
+ # produce undesired source control changes. If the custom bundle was just created and either `ruby-lsp` or `debug`
130
+ # weren't a part of the Gemfile, then we need to run `bundle install` for the first time to generate the
131
+ # Gemfile.lock with them included or else Bundler will complain that they're missing. We can only update if the
132
+ # custom `.ruby-lsp/Gemfile.lock` already exists and includes both gems
133
+ if (@dependencies["ruby-lsp"] && @dependencies["debug"]) ||
134
+ @custom_bundle_dependencies["ruby-lsp"].nil? || @custom_bundle_dependencies["debug"].nil?
115
135
  # Install gems using the custom bundle
116
136
  command << "bundle install "
117
137
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify