ruby-lsp 0.10.0 → 0.10.1
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_indexer/lib/ruby_indexer/visitor.rb +1 -1
- data/lib/ruby_indexer/test/classes_and_modules_test.rb +16 -16
- data/lib/ruby_indexer/test/constant_test.rb +11 -11
- data/lib/ruby_lsp/requests/document_link.rb +3 -1
- data/lib/ruby_lsp/setup_bundler.rb +22 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36eafde3135250941805bf340b782dfab3002839b66ba4722d261edd7fe1356a
|
4
|
+
data.tar.gz: f8dbfe5eb36489223c21d2e816f91324d0928895632a4344c16ecc756c0cb279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24312d8a758e8388c02165d8f0ee4a8f8ccb93bb71efbd3ed3a4eeeadeb750373856cdcd3842f2cb1138ef7067c7c497260adeee347cc37f81e960a1febb7a44
|
7
|
+
data.tar.gz: c637ef4a50da10f0a7d81a15e9fc7af209e6a056642c93b315e0410fbfe732a8f42cd841ca3d70f66fac79d54474253a8febfe60f487c970632e64fd88ce103b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
@@ -57,7 +57,7 @@ module RubyIndexer
|
|
57
57
|
end
|
58
58
|
def add_constant(node)
|
59
59
|
comments = collect_comments(node)
|
60
|
-
@index << Index::Entry::Constant.new(fully_qualify_name(node.name), @file_path, node.location, comments)
|
60
|
+
@index << Index::Entry::Constant.new(fully_qualify_name(node.name.to_s), @file_path, node.location, comments)
|
61
61
|
end
|
62
62
|
|
63
63
|
sig do
|
@@ -11,7 +11,7 @@ module RubyIndexer
|
|
11
11
|
end
|
12
12
|
RUBY
|
13
13
|
|
14
|
-
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-
|
14
|
+
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_class_with_statements
|
@@ -21,7 +21,7 @@ module RubyIndexer
|
|
21
21
|
end
|
22
22
|
RUBY
|
23
23
|
|
24
|
-
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:2-
|
24
|
+
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:2-3")
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_colon_colon_class
|
@@ -30,7 +30,7 @@ module RubyIndexer
|
|
30
30
|
end
|
31
31
|
RUBY
|
32
32
|
|
33
|
-
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-
|
33
|
+
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_colon_colon_class_inside_class
|
@@ -41,8 +41,8 @@ module RubyIndexer
|
|
41
41
|
end
|
42
42
|
RUBY
|
43
43
|
|
44
|
-
assert_entry("Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:3-
|
45
|
-
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-
|
44
|
+
assert_entry("Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:3-3")
|
45
|
+
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-5")
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_namespaced_class
|
@@ -51,7 +51,7 @@ module RubyIndexer
|
|
51
51
|
end
|
52
52
|
RUBY
|
53
53
|
|
54
|
-
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-
|
54
|
+
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_dynamically_namespaced_class
|
@@ -69,7 +69,7 @@ module RubyIndexer
|
|
69
69
|
end
|
70
70
|
RUBY
|
71
71
|
|
72
|
-
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-
|
72
|
+
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_module_with_statements
|
@@ -79,7 +79,7 @@ module RubyIndexer
|
|
79
79
|
end
|
80
80
|
RUBY
|
81
81
|
|
82
|
-
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:2-
|
82
|
+
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:2-3")
|
83
83
|
end
|
84
84
|
|
85
85
|
def test_colon_colon_module
|
@@ -88,7 +88,7 @@ module RubyIndexer
|
|
88
88
|
end
|
89
89
|
RUBY
|
90
90
|
|
91
|
-
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-
|
91
|
+
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
|
92
92
|
end
|
93
93
|
|
94
94
|
def test_namespaced_module
|
@@ -97,7 +97,7 @@ module RubyIndexer
|
|
97
97
|
end
|
98
98
|
RUBY
|
99
99
|
|
100
|
-
assert_entry("Foo::Bar", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-
|
100
|
+
assert_entry("Foo::Bar", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_dynamically_namespaced_module
|
@@ -124,11 +124,11 @@ module RubyIndexer
|
|
124
124
|
end
|
125
125
|
RUBY
|
126
126
|
|
127
|
-
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:10-
|
128
|
-
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-
|
129
|
-
assert_entry("Foo::Baz", Index::Entry::Module, "/fake/path/foo.rb:4-2:9-
|
130
|
-
assert_entry("Foo::Baz::Qux", Index::Entry::Class, "/fake/path/foo.rb:5-4:8-
|
131
|
-
assert_entry("Foo::Baz::Qux::Something", Index::Entry::Class, "/fake/path/foo.rb:6-6:7-
|
127
|
+
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:10-3")
|
128
|
+
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-5")
|
129
|
+
assert_entry("Foo::Baz", Index::Entry::Module, "/fake/path/foo.rb:4-2:9-5")
|
130
|
+
assert_entry("Foo::Baz::Qux", Index::Entry::Class, "/fake/path/foo.rb:5-4:8-7")
|
131
|
+
assert_entry("Foo::Baz::Qux::Something", Index::Entry::Class, "/fake/path/foo.rb:6-6:7-9")
|
132
132
|
end
|
133
133
|
|
134
134
|
def test_deleting_from_index_based_on_file_path
|
@@ -137,7 +137,7 @@ module RubyIndexer
|
|
137
137
|
end
|
138
138
|
RUBY
|
139
139
|
|
140
|
-
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-
|
140
|
+
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
|
141
141
|
|
142
142
|
@index.delete(IndexablePath.new(nil, "/fake/path/foo.rb"))
|
143
143
|
refute_entry("Foo")
|
@@ -14,8 +14,8 @@ module RubyIndexer
|
|
14
14
|
end
|
15
15
|
RUBY
|
16
16
|
|
17
|
-
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-
|
18
|
-
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-
|
17
|
+
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-7")
|
18
|
+
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-9")
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_constant_or_writes
|
@@ -27,8 +27,8 @@ module RubyIndexer
|
|
27
27
|
end
|
28
28
|
RUBY
|
29
29
|
|
30
|
-
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-
|
31
|
-
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-
|
30
|
+
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-9")
|
31
|
+
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-11")
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_constant_path_writes
|
@@ -45,10 +45,10 @@ module RubyIndexer
|
|
45
45
|
A::BAZ = 1
|
46
46
|
RUBY
|
47
47
|
|
48
|
-
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-
|
49
|
-
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-
|
50
|
-
assert_entry("A::B::FOO", Index::Entry::Constant, "/fake/path/foo.rb:5-4:5-
|
51
|
-
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:9-0:9-
|
48
|
+
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-9")
|
49
|
+
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-11")
|
50
|
+
assert_entry("A::B::FOO", Index::Entry::Constant, "/fake/path/foo.rb:5-4:5-11")
|
51
|
+
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:9-0:9-10")
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_constant_path_or_writes
|
@@ -61,9 +61,9 @@ module RubyIndexer
|
|
61
61
|
A::BAZ ||= 1
|
62
62
|
RUBY
|
63
63
|
|
64
|
-
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-
|
65
|
-
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-
|
66
|
-
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:5-0:5-
|
64
|
+
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-11")
|
65
|
+
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-13")
|
66
|
+
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:5-0:5-12")
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_comments_for_constants
|
@@ -95,7 +95,9 @@ module RubyLsp
|
|
95
95
|
return unless match
|
96
96
|
|
97
97
|
uri = T.cast(URI(T.must(match[0])), URI::Source)
|
98
|
-
gem_version =
|
98
|
+
gem_version = resolve_version(uri)
|
99
|
+
return if gem_version.nil?
|
100
|
+
|
99
101
|
file_path = self.class.gem_paths.dig(uri.gem_name, gem_version, CGI.unescape(uri.path))
|
100
102
|
return if file_path.nil?
|
101
103
|
|
@@ -175,20 +175,24 @@ module RubyLsp
|
|
175
175
|
# weren't a part of the Gemfile, then we need to run `bundle install` for the first time to generate the
|
176
176
|
# Gemfile.lock with them included or else Bundler will complain that they're missing. We can only update if the
|
177
177
|
# custom `.ruby-lsp/Gemfile.lock` already exists and includes both gems
|
178
|
-
command = +""
|
179
178
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
179
|
+
# When not updating, we run `(bundle check || bundle install)`
|
180
|
+
# When updating, we run `((bundle check && bundle update ruby-lsp debug) || bundle install)`
|
181
|
+
command = +"(bundle check"
|
182
|
+
|
183
|
+
if should_bundle_update?
|
184
184
|
# If ruby-lsp or debug are not in the Gemfile, try to update them to the latest version
|
185
|
-
command
|
185
|
+
command.prepend("(")
|
186
|
+
command << " && bundle update "
|
186
187
|
command << "ruby-lsp " unless @dependencies["ruby-lsp"]
|
187
|
-
command << "debug
|
188
|
+
command << "debug" unless @dependencies["debug"]
|
189
|
+
command << ")"
|
188
190
|
|
189
191
|
@last_updated_path.write(Time.now.iso8601)
|
190
192
|
end
|
191
193
|
|
194
|
+
command << " || bundle install) "
|
195
|
+
|
192
196
|
# Redirect stdout to stderr to prevent going into an infinite loop. The extension might confuse stdout output with
|
193
197
|
# responses
|
194
198
|
command << "1>&2"
|
@@ -200,10 +204,17 @@ module RubyLsp
|
|
200
204
|
end
|
201
205
|
|
202
206
|
sig { returns(T::Boolean) }
|
203
|
-
def
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
+
def should_bundle_update?
|
208
|
+
# If both `ruby-lsp` and `debug` are in the Gemfile, then we shouldn't try to upgrade them or else it will produce
|
209
|
+
# version control changes
|
210
|
+
return false if @dependencies["ruby-lsp"] && @dependencies["debug"]
|
211
|
+
|
212
|
+
# If the custom lockfile doesn't include either the `ruby-lsp` or `debug`, we need to run bundle install before
|
213
|
+
# updating
|
214
|
+
return false if custom_bundle_dependencies["ruby-lsp"].nil? || custom_bundle_dependencies["debug"].nil?
|
215
|
+
|
216
|
+
# If the last updated file doesn't exist or was updated more than 4 hours ago, we should update
|
217
|
+
!@last_updated_path.exist? || Time.parse(@last_updated_path.read) < (Time.now - FOUR_HOURS)
|
207
218
|
end
|
208
219
|
end
|
209
220
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: language_server-protocol
|
@@ -64,20 +64,20 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0.
|
67
|
+
version: '0.11'
|
68
68
|
- - "<"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '0.
|
70
|
+
version: '0.12'
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0.
|
77
|
+
version: '0.11'
|
78
78
|
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '0.
|
80
|
+
version: '0.12'
|
81
81
|
description: An opinionated language server for Ruby
|
82
82
|
email:
|
83
83
|
- ruby@shopify.com
|