ruby-lsp 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d58ee884d1824478d6c0823475b061ca15ac7b28046969a98b0e27643fb943a0
4
- data.tar.gz: c90b7a8dbcd675625a28d23cc42d8821b6fe701ce66fb417f885a013c289cd61
3
+ metadata.gz: dba33af47ce558162b73c39422465b451e4af9e835d9446ff90414de0f44fd66
4
+ data.tar.gz: fb9b769fceb2563b2392b6395cb65a17511e5dee9614d8158fb28c5bd5628843
5
5
  SHA512:
6
- metadata.gz: e39e30da28ef6118ab12fd1f4d82ca701f1f4f7e3a0f14c51df99b7adc118f81e018aee031e3f36b92423bd20771c82ed4275b3276a4fe6b03a13246acc53070
7
- data.tar.gz: f2d5fa3658bc0bc89ab6fd714f26565b916ef25787e82affdcdd0ff68a3fc31b2a3ffc62fe31ca09c07052e5fe0667fe59bcbfc48d8a563cd893b9c247409dac
6
+ metadata.gz: 53b879df720b44940dc838245a174bebc08849d6673a9076b612df90a47036e69fdc367cc7e0dc3df934a762758e36cebea2d6c84e4b3e992023f2bf9056b14f
7
+ data.tar.gz: 65856714024b1329d693cc49eb3e846af1b7737dfd4f914ddb2b677ddada993cca65f81ec9447605325380aee2564930ee2401efc87e57f9d11e92600533d9ca
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -17,6 +17,14 @@ module RubyLsp
17
17
  def initialize(project_path)
18
18
  @project_path = project_path
19
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
+ )
20
28
  end
21
29
 
22
30
  sig { void }
@@ -31,6 +39,11 @@ module RubyLsp
31
39
  # Do not setup a custom bundle if both `ruby-lsp` and `debug` are already in the Gemfile
32
40
  if @dependencies["ruby-lsp"] && @dependencies["debug"]
33
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")
34
47
  run_bundle_install
35
48
  return
36
49
  end
@@ -112,7 +125,13 @@ module RubyLsp
112
125
  command << "BUNDLE_PATH=#{File.expand_path(path, Dir.pwd)} " if path
113
126
  command << "BUNDLE_GEMFILE=#{bundle_gemfile} " if bundle_gemfile
114
127
 
115
- 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?
116
135
  # Install gems using the custom bundle
117
136
  command << "bundle install "
118
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.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify