ruby-lsp 0.7.2 → 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 +4 -4
- data/VERSION +1 -1
- data/lib/ruby_lsp/setup_bundler.rb +20 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dba33af47ce558162b73c39422465b451e4af9e835d9446ff90414de0f44fd66
|
4
|
+
data.tar.gz: fb9b769fceb2563b2392b6395cb65a17511e5dee9614d8158fb28c5bd5628843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b879df720b44940dc838245a174bebc08849d6673a9076b612df90a47036e69fdc367cc7e0dc3df934a762758e36cebea2d6c84e4b3e992023f2bf9056b14f
|
7
|
+
data.tar.gz: 65856714024b1329d693cc49eb3e846af1b7737dfd4f914ddb2b677ddada993cca65f81ec9447605325380aee2564930ee2401efc87e57f9d11e92600533d9ca
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
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
|
-
|
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
|