ruby-lsp 0.17.9 → 0.17.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/exe/ruby-lsp +1 -1
- data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +3 -3
- data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +4 -4
- data/lib/ruby_indexer/lib/ruby_indexer/index.rb +25 -24
- data/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +70 -5
- data/lib/ruby_indexer/test/constant_test.rb +17 -17
- data/lib/ruby_indexer/test/index_test.rb +67 -10
- data/lib/ruby_indexer/test/rbs_indexer_test.rb +38 -0
- data/lib/ruby_lsp/listeners/definition.rb +24 -3
- data/lib/ruby_lsp/listeners/document_highlight.rb +5 -1
- data/lib/ruby_lsp/node_context.rb +2 -2
- data/lib/ruby_lsp/requests/code_actions.rb +5 -2
- data/lib/ruby_lsp/requests/definition.rb +9 -2
- data/lib/ruby_lsp/requests/diagnostics.rb +6 -5
- data/lib/ruby_lsp/requests/document_symbol.rb +2 -7
- data/lib/ruby_lsp/requests/folding_ranges.rb +6 -2
- data/lib/ruby_lsp/requests/formatting.rb +13 -0
- data/lib/ruby_lsp/requests/hover.rb +2 -2
- data/lib/ruby_lsp/requests/on_type_formatting.rb +6 -4
- data/lib/ruby_lsp/server.rb +2 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13815c41a1b7509782277cb5dac09481130e18efc4253a01cede31ca41b335a7
|
4
|
+
data.tar.gz: 40e6584ff6ff743ea1e62a29d6090d80bf318ae3dd5d90808de1b35723bea063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74da4b254b598cd4b10701b65c49d045cc33be83330399e67602f8e43597c9e54567715343a67fa720b31084de540e498cc3d5525e64679500d52b4842e44cf7
|
7
|
+
data.tar.gz: 313695187e34ceb34c50d320bbe0abe0bda18d99157e8f4710faf8f72bc5028abd813511665fd4eac274dd73606eebb1c901b949fa307a8f925c2bfaa39b0c45
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ The Ruby LSP features include
|
|
33
33
|
- Completion for classes, modules, constants and require paths
|
34
34
|
- Fuzzy search classes, modules and constants anywhere in the project and its dependencies (workspace symbol)
|
35
35
|
|
36
|
-
|
36
|
+
As of July 2024, Ruby LSP has received significant enhancements to its code navigation features. For an in-depth look at these improvements, including video demonstrations, check out this [article](https://railsatscale.com/2024-07-18-mastering-ruby-code-navigation-major-enhancements-in-ruby-lsp-2024/). Despite these advancements, we plan to continue enhancing its code navigation support even further. You can follow our progress on this [GitHub issue](https://github.com/Shopify/ruby-lsp/issues/899).
|
37
37
|
|
38
38
|
See complete information about features [here](https://shopify.github.io/ruby-lsp/RubyLsp/Requests.html).
|
39
39
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.
|
1
|
+
0.17.11
|
data/exe/ruby-lsp
CHANGED
@@ -106,7 +106,7 @@ if options[:time_index]
|
|
106
106
|
|
107
107
|
puts <<~MSG
|
108
108
|
Ruby LSP v#{RubyLsp::VERSION}: Indexing took #{result.round(5)} seconds and generated:
|
109
|
-
- #{entries_by_entry_type.map { |k, v| "#{k.name.split("::").last}: #{v.size}" }.join("\n- ")}
|
109
|
+
- #{entries_by_entry_type.sort_by { |k, _| k.to_s }.map { |k, v| "#{k.name.split("::").last}: #{v.size}" }.join("\n- ")}
|
110
110
|
MSG
|
111
111
|
return
|
112
112
|
end
|
@@ -504,17 +504,17 @@ module RubyIndexer
|
|
504
504
|
@index.add(
|
505
505
|
case value
|
506
506
|
when Prism::ConstantReadNode, Prism::ConstantPathNode
|
507
|
-
Entry::
|
507
|
+
Entry::UnresolvedConstantAlias.new(value.slice, @stack.dup, name, @file_path, node.location, comments)
|
508
508
|
when Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode,
|
509
509
|
Prism::ConstantOperatorWriteNode
|
510
510
|
|
511
511
|
# If the right hand side is another constant assignment, we need to visit it because that constant has to be
|
512
512
|
# indexed too
|
513
|
-
Entry::
|
513
|
+
Entry::UnresolvedConstantAlias.new(value.name.to_s, @stack.dup, name, @file_path, node.location, comments)
|
514
514
|
when Prism::ConstantPathWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode,
|
515
515
|
Prism::ConstantPathAndWriteNode
|
516
516
|
|
517
|
-
Entry::
|
517
|
+
Entry::UnresolvedConstantAlias.new(value.target.slice, @stack.dup, name, @file_path, node.location, comments)
|
518
518
|
else
|
519
519
|
Entry::Constant.new(name, @file_path, node.location, comments)
|
520
520
|
end,
|
@@ -411,7 +411,7 @@ module RubyIndexer
|
|
411
411
|
# All aliases are inserted as UnresolvedAlias in the index first and then we lazily resolve them to the correct
|
412
412
|
# target in [rdoc-ref:Index#resolve]. If the right hand side contains a constant that doesn't exist, then it's not
|
413
413
|
# possible to resolve the alias and it will remain an UnresolvedAlias until the right hand side constant exists
|
414
|
-
class
|
414
|
+
class UnresolvedConstantAlias < Entry
|
415
415
|
extend T::Sig
|
416
416
|
|
417
417
|
sig { returns(String) }
|
@@ -439,13 +439,13 @@ module RubyIndexer
|
|
439
439
|
end
|
440
440
|
|
441
441
|
# Alias represents a resolved alias, which points to an existing constant target
|
442
|
-
class
|
442
|
+
class ConstantAlias < Entry
|
443
443
|
extend T::Sig
|
444
444
|
|
445
445
|
sig { returns(String) }
|
446
446
|
attr_reader :target
|
447
447
|
|
448
|
-
sig { params(target: String, unresolved_alias:
|
448
|
+
sig { params(target: String, unresolved_alias: UnresolvedConstantAlias).void }
|
449
449
|
def initialize(target, unresolved_alias)
|
450
450
|
super(unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments)
|
451
451
|
|
@@ -492,7 +492,7 @@ module RubyIndexer
|
|
492
492
|
old_name: String,
|
493
493
|
owner: T.nilable(Entry::Namespace),
|
494
494
|
file_path: String,
|
495
|
-
location: Prism::Location,
|
495
|
+
location: T.any(Prism::Location, RubyIndexer::Location),
|
496
496
|
comments: T::Array[String],
|
497
497
|
).void
|
498
498
|
end
|
@@ -91,8 +91,8 @@ module RubyIndexer
|
|
91
91
|
name: String,
|
92
92
|
).returns(T.nilable(T::Array[T.any(
|
93
93
|
Entry::Namespace,
|
94
|
-
Entry::
|
95
|
-
Entry::
|
94
|
+
Entry::ConstantAlias,
|
95
|
+
Entry::UnresolvedConstantAlias,
|
96
96
|
Entry::Constant,
|
97
97
|
)]))
|
98
98
|
end
|
@@ -105,8 +105,8 @@ module RubyIndexer
|
|
105
105
|
entries,
|
106
106
|
T.nilable(T::Array[T.any(
|
107
107
|
Entry::Namespace,
|
108
|
-
Entry::
|
109
|
-
Entry::
|
108
|
+
Entry::ConstantAlias,
|
109
|
+
Entry::UnresolvedConstantAlias,
|
110
110
|
Entry::Constant,
|
111
111
|
)]),
|
112
112
|
)
|
@@ -230,8 +230,8 @@ module RubyIndexer
|
|
230
230
|
seen_names: T::Array[String],
|
231
231
|
).returns(T.nilable(T::Array[T.any(
|
232
232
|
Entry::Namespace,
|
233
|
-
Entry::
|
234
|
-
Entry::
|
233
|
+
Entry::ConstantAlias,
|
234
|
+
Entry::UnresolvedConstantAlias,
|
235
235
|
)]))
|
236
236
|
end
|
237
237
|
def resolve(name, nesting, seen_names = [])
|
@@ -276,6 +276,7 @@ module RubyIndexer
|
|
276
276
|
).void
|
277
277
|
end
|
278
278
|
def index_all(indexable_paths: RubyIndexer.configuration.indexables, &block)
|
279
|
+
RBSIndexer.new(self).index_ruby_core
|
279
280
|
# Calculate how many paths are worth 1% of progress
|
280
281
|
progress_step = (indexable_paths.length / 100.0).ceil
|
281
282
|
|
@@ -333,13 +334,13 @@ module RubyIndexer
|
|
333
334
|
entry = @entries[current_name]&.first
|
334
335
|
|
335
336
|
case entry
|
336
|
-
when Entry::
|
337
|
+
when Entry::ConstantAlias
|
337
338
|
target = entry.target
|
338
339
|
return follow_aliased_namespace("#{target}::#{real_parts.join("::")}", seen_names)
|
339
|
-
when Entry::
|
340
|
+
when Entry::UnresolvedConstantAlias
|
340
341
|
resolved = resolve_alias(entry, seen_names)
|
341
342
|
|
342
|
-
if resolved.is_a?(Entry::
|
343
|
+
if resolved.is_a?(Entry::UnresolvedConstantAlias)
|
343
344
|
raise UnresolvableAliasError, "The constant #{resolved.name} is an alias to a non existing constant"
|
344
345
|
end
|
345
346
|
|
@@ -438,7 +439,7 @@ module RubyIndexer
|
|
438
439
|
case entry
|
439
440
|
when Entry::Namespace
|
440
441
|
entry
|
441
|
-
when Entry::
|
442
|
+
when Entry::ConstantAlias
|
442
443
|
self[entry.target]&.grep(Entry::Namespace)
|
443
444
|
end
|
444
445
|
end.flatten
|
@@ -448,7 +449,7 @@ module RubyIndexer
|
|
448
449
|
|
449
450
|
# The original nesting where we discovered this namespace, so that we resolve the correct names of the
|
450
451
|
# included/prepended/extended modules and parent classes
|
451
|
-
nesting = T.must(namespaces.first).nesting
|
452
|
+
nesting = T.must(namespaces.first).nesting.flat_map { |n| n.split("::") }
|
452
453
|
|
453
454
|
if nesting.any?
|
454
455
|
singleton_levels.times do
|
@@ -657,7 +658,7 @@ module RubyIndexer
|
|
657
658
|
|
658
659
|
if parent_class_name && fully_qualified_name != parent_class_name
|
659
660
|
|
660
|
-
parent_name_parts =
|
661
|
+
parent_name_parts = parent_class_name.split("::")
|
661
662
|
singleton_levels.times do
|
662
663
|
parent_name_parts << "<Class:#{parent_name_parts.last}>"
|
663
664
|
end
|
@@ -697,9 +698,9 @@ module RubyIndexer
|
|
697
698
|
# that doesn't exist, then we return the same UnresolvedAlias
|
698
699
|
sig do
|
699
700
|
params(
|
700
|
-
entry: Entry::
|
701
|
+
entry: Entry::UnresolvedConstantAlias,
|
701
702
|
seen_names: T::Array[String],
|
702
|
-
).returns(T.any(Entry::
|
703
|
+
).returns(T.any(Entry::ConstantAlias, Entry::UnresolvedConstantAlias))
|
703
704
|
end
|
704
705
|
def resolve_alias(entry, seen_names)
|
705
706
|
alias_name = entry.name
|
@@ -711,7 +712,7 @@ module RubyIndexer
|
|
711
712
|
return entry unless target
|
712
713
|
|
713
714
|
target_name = T.must(target.first).name
|
714
|
-
resolved_alias = Entry::
|
715
|
+
resolved_alias = Entry::ConstantAlias.new(target_name, entry)
|
715
716
|
|
716
717
|
# Replace the UnresolvedAlias by a resolved one so that we don't have to do this again later
|
717
718
|
original_entries = T.must(@entries[alias_name])
|
@@ -730,8 +731,8 @@ module RubyIndexer
|
|
730
731
|
seen_names: T::Array[String],
|
731
732
|
).returns(T.nilable(T::Array[T.any(
|
732
733
|
Entry::Namespace,
|
733
|
-
Entry::
|
734
|
-
Entry::
|
734
|
+
Entry::ConstantAlias,
|
735
|
+
Entry::UnresolvedConstantAlias,
|
735
736
|
)]))
|
736
737
|
end
|
737
738
|
def lookup_enclosing_scopes(name, nesting, seen_names)
|
@@ -759,8 +760,8 @@ module RubyIndexer
|
|
759
760
|
seen_names: T::Array[String],
|
760
761
|
).returns(T.nilable(T::Array[T.any(
|
761
762
|
Entry::Namespace,
|
762
|
-
Entry::
|
763
|
-
Entry::
|
763
|
+
Entry::ConstantAlias,
|
764
|
+
Entry::UnresolvedConstantAlias,
|
764
765
|
)]))
|
765
766
|
end
|
766
767
|
def lookup_ancestor_chain(name, nesting, seen_names)
|
@@ -820,8 +821,8 @@ module RubyIndexer
|
|
820
821
|
).returns(
|
821
822
|
T.nilable(T::Array[T.any(
|
822
823
|
Entry::Namespace,
|
823
|
-
Entry::
|
824
|
-
Entry::
|
824
|
+
Entry::ConstantAlias,
|
825
|
+
Entry::UnresolvedConstantAlias,
|
825
826
|
)]),
|
826
827
|
)
|
827
828
|
end
|
@@ -829,11 +830,11 @@ module RubyIndexer
|
|
829
830
|
entries = @entries[full_name] || @entries[follow_aliased_namespace(full_name)]
|
830
831
|
|
831
832
|
T.cast(
|
832
|
-
entries&.map { |e| e.is_a?(Entry::
|
833
|
+
entries&.map { |e| e.is_a?(Entry::UnresolvedConstantAlias) ? resolve_alias(e, seen_names) : e },
|
833
834
|
T.nilable(T::Array[T.any(
|
834
835
|
Entry::Namespace,
|
835
|
-
Entry::
|
836
|
-
Entry::
|
836
|
+
Entry::ConstantAlias,
|
837
|
+
Entry::UnresolvedConstantAlias,
|
837
838
|
)]),
|
838
839
|
)
|
839
840
|
end
|
@@ -39,6 +39,9 @@ module RubyIndexer
|
|
39
39
|
case declaration
|
40
40
|
when RBS::AST::Declarations::Class, RBS::AST::Declarations::Module
|
41
41
|
handle_class_or_module_declaration(declaration, pathname)
|
42
|
+
when RBS::AST::Declarations::Constant
|
43
|
+
namespace_nesting = declaration.name.namespace.path.map(&:to_s)
|
44
|
+
handle_constant(declaration, namespace_nesting, pathname.to_s)
|
42
45
|
else # rubocop:disable Style/EmptyElse
|
43
46
|
# Other kinds not yet handled
|
44
47
|
end
|
@@ -51,7 +54,7 @@ module RubyIndexer
|
|
51
54
|
nesting = [declaration.name.name.to_s]
|
52
55
|
file_path = pathname.to_s
|
53
56
|
location = to_ruby_indexer_location(declaration.location)
|
54
|
-
comments =
|
57
|
+
comments = comments_to_string(declaration)
|
55
58
|
entry = if declaration.is_a?(RBS::AST::Declarations::Class)
|
56
59
|
parent_class = declaration.super_class&.name&.name&.to_s
|
57
60
|
Entry::Class.new(nesting, file_path, location, location, comments, parent_class)
|
@@ -61,9 +64,16 @@ module RubyIndexer
|
|
61
64
|
add_declaration_mixins_to_entry(declaration, entry)
|
62
65
|
@index.add(entry)
|
63
66
|
declaration.members.each do |member|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
+
case member
|
68
|
+
when RBS::AST::Members::MethodDefinition
|
69
|
+
handle_method(member, entry)
|
70
|
+
when RBS::AST::Declarations::Constant
|
71
|
+
handle_constant(member, nesting, file_path)
|
72
|
+
when RBS::AST::Members::Alias
|
73
|
+
# In RBS, an alias means that two methods have the same signature.
|
74
|
+
# It does not mean the same thing as a Ruby alias.
|
75
|
+
handle_signature_alias(member, entry)
|
76
|
+
end
|
67
77
|
end
|
68
78
|
end
|
69
79
|
|
@@ -103,7 +113,7 @@ module RubyIndexer
|
|
103
113
|
name = member.name.name
|
104
114
|
file_path = member.location.buffer.name
|
105
115
|
location = to_ruby_indexer_location(member.location)
|
106
|
-
comments =
|
116
|
+
comments = comments_to_string(member)
|
107
117
|
|
108
118
|
visibility = case member.visibility
|
109
119
|
when :private
|
@@ -212,5 +222,60 @@ module RubyIndexer
|
|
212
222
|
|
213
223
|
Entry::KeywordRestParameter.new(name: name)
|
214
224
|
end
|
225
|
+
|
226
|
+
# RBS treats constant definitions differently depend on where they are defined.
|
227
|
+
# When constants' rbs are defined inside a class/module block, they are treated as
|
228
|
+
# members of the class/module.
|
229
|
+
#
|
230
|
+
# module Encoding
|
231
|
+
# US_ASCII = ... # US_ASCII is a member of Encoding
|
232
|
+
# end
|
233
|
+
#
|
234
|
+
# When constants' rbs are defined outside a class/module block, they are treated as
|
235
|
+
# top-level constants.
|
236
|
+
#
|
237
|
+
# Complex::I = ... # Complex::I is a top-level constant
|
238
|
+
#
|
239
|
+
# And we need to handle their nesting differently.
|
240
|
+
sig { params(declaration: RBS::AST::Declarations::Constant, nesting: T::Array[String], file_path: String).void }
|
241
|
+
def handle_constant(declaration, nesting, file_path)
|
242
|
+
fully_qualified_name = [*nesting, declaration.name.name.to_s].join("::")
|
243
|
+
@index.add(Entry::Constant.new(
|
244
|
+
fully_qualified_name,
|
245
|
+
file_path,
|
246
|
+
to_ruby_indexer_location(declaration.location),
|
247
|
+
comments_to_string(declaration),
|
248
|
+
))
|
249
|
+
end
|
250
|
+
|
251
|
+
sig { params(member: RBS::AST::Members::Alias, owner_entry: Entry::Namespace).void }
|
252
|
+
def handle_signature_alias(member, owner_entry)
|
253
|
+
file_path = member.location.buffer.name
|
254
|
+
comments = comments_to_string(member)
|
255
|
+
|
256
|
+
entry = Entry::UnresolvedMethodAlias.new(
|
257
|
+
member.new_name.to_s,
|
258
|
+
member.old_name.to_s,
|
259
|
+
owner_entry,
|
260
|
+
file_path,
|
261
|
+
to_ruby_indexer_location(member.location),
|
262
|
+
comments,
|
263
|
+
)
|
264
|
+
|
265
|
+
@index.add(entry)
|
266
|
+
end
|
267
|
+
|
268
|
+
sig do
|
269
|
+
params(declaration: T.any(
|
270
|
+
RBS::AST::Declarations::Class,
|
271
|
+
RBS::AST::Declarations::Module,
|
272
|
+
RBS::AST::Declarations::Constant,
|
273
|
+
RBS::AST::Members::MethodDefinition,
|
274
|
+
RBS::AST::Members::Alias,
|
275
|
+
)).returns(T::Array[String])
|
276
|
+
end
|
277
|
+
def comments_to_string(declaration)
|
278
|
+
Array(declaration.comment&.string)
|
279
|
+
end
|
215
280
|
end
|
216
281
|
end
|
@@ -200,12 +200,12 @@ module RubyIndexer
|
|
200
200
|
RUBY
|
201
201
|
|
202
202
|
unresolve_entry = @index["A::FIRST"].first
|
203
|
-
assert_instance_of(Entry::
|
203
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
204
204
|
assert_equal(["A"], unresolve_entry.nesting)
|
205
205
|
assert_equal("B::C", unresolve_entry.target)
|
206
206
|
|
207
207
|
resolved_entry = @index.resolve("A::FIRST", []).first
|
208
|
-
assert_instance_of(Entry::
|
208
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
209
209
|
assert_equal("A::B::C", resolved_entry.target)
|
210
210
|
end
|
211
211
|
|
@@ -226,12 +226,12 @@ module RubyIndexer
|
|
226
226
|
RUBY
|
227
227
|
|
228
228
|
unresolve_entry = @index["A::ALIAS"].first
|
229
|
-
assert_instance_of(Entry::
|
229
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
230
230
|
assert_equal(["A"], unresolve_entry.nesting)
|
231
231
|
assert_equal("B", unresolve_entry.target)
|
232
232
|
|
233
233
|
resolved_entry = @index.resolve("ALIAS", ["A"]).first
|
234
|
-
assert_instance_of(Entry::
|
234
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
235
235
|
assert_equal("A::B", resolved_entry.target)
|
236
236
|
|
237
237
|
resolved_entry = @index.resolve("ALIAS::C", ["A"]).first
|
@@ -239,7 +239,7 @@ module RubyIndexer
|
|
239
239
|
assert_equal("A::B::C", resolved_entry.name)
|
240
240
|
|
241
241
|
unresolve_entry = @index["Other::ONE_MORE"].first
|
242
|
-
assert_instance_of(Entry::
|
242
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
243
243
|
assert_equal(["Other"], unresolve_entry.nesting)
|
244
244
|
assert_equal("A::ALIAS", unresolve_entry.target)
|
245
245
|
|
@@ -259,12 +259,12 @@ module RubyIndexer
|
|
259
259
|
|
260
260
|
# B and C
|
261
261
|
unresolve_entry = @index["A::B"].first
|
262
|
-
assert_instance_of(Entry::
|
262
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
263
263
|
assert_equal(["A"], unresolve_entry.nesting)
|
264
264
|
assert_equal("C", unresolve_entry.target)
|
265
265
|
|
266
266
|
resolved_entry = @index.resolve("A::B", []).first
|
267
|
-
assert_instance_of(Entry::
|
267
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
268
268
|
assert_equal("A::C", resolved_entry.target)
|
269
269
|
|
270
270
|
constant = @index["A::C"].first
|
@@ -272,38 +272,38 @@ module RubyIndexer
|
|
272
272
|
|
273
273
|
# D and E
|
274
274
|
unresolve_entry = @index["A::D"].first
|
275
|
-
assert_instance_of(Entry::
|
275
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
276
276
|
assert_equal(["A"], unresolve_entry.nesting)
|
277
277
|
assert_equal("E", unresolve_entry.target)
|
278
278
|
|
279
279
|
resolved_entry = @index.resolve("A::D", []).first
|
280
|
-
assert_instance_of(Entry::
|
280
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
281
281
|
assert_equal("A::E", resolved_entry.target)
|
282
282
|
|
283
283
|
# F and G::H
|
284
284
|
unresolve_entry = @index["A::F"].first
|
285
|
-
assert_instance_of(Entry::
|
285
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
286
286
|
assert_equal(["A"], unresolve_entry.nesting)
|
287
287
|
assert_equal("G::H", unresolve_entry.target)
|
288
288
|
|
289
289
|
resolved_entry = @index.resolve("A::F", []).first
|
290
|
-
assert_instance_of(Entry::
|
290
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
291
291
|
assert_equal("A::G::H", resolved_entry.target)
|
292
292
|
|
293
293
|
# I::J, K::L and M
|
294
294
|
unresolve_entry = @index["A::I::J"].first
|
295
|
-
assert_instance_of(Entry::
|
295
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, unresolve_entry)
|
296
296
|
assert_equal(["A"], unresolve_entry.nesting)
|
297
297
|
assert_equal("K::L", unresolve_entry.target)
|
298
298
|
|
299
299
|
resolved_entry = @index.resolve("A::I::J", []).first
|
300
|
-
assert_instance_of(Entry::
|
300
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
301
301
|
assert_equal("A::K::L", resolved_entry.target)
|
302
302
|
|
303
303
|
# When we are resolving A::I::J, we invoke `resolve("K::L", ["A"])`, which recursively resolves A::K::L too.
|
304
304
|
# Therefore, both A::I::J and A::K::L point to A::M by the end of the previous resolve invocation
|
305
305
|
resolved_entry = @index["A::K::L"].first
|
306
|
-
assert_instance_of(Entry::
|
306
|
+
assert_instance_of(Entry::ConstantAlias, resolved_entry)
|
307
307
|
assert_equal("A::M", resolved_entry.target)
|
308
308
|
|
309
309
|
constant = @index["A::M"].first
|
@@ -344,11 +344,11 @@ module RubyIndexer
|
|
344
344
|
RUBY
|
345
345
|
|
346
346
|
assert_entry("A::B", Entry::Constant, "/fake/path/foo.rb:1-2:1-3")
|
347
|
-
assert_entry("A::C", Entry::
|
348
|
-
assert_entry("A::D::E", Entry::
|
347
|
+
assert_entry("A::C", Entry::UnresolvedConstantAlias, "/fake/path/foo.rb:1-5:1-6")
|
348
|
+
assert_entry("A::D::E", Entry::UnresolvedConstantAlias, "/fake/path/foo.rb:2-2:2-6")
|
349
349
|
assert_entry("A::F::G", Entry::Constant, "/fake/path/foo.rb:2-8:2-12")
|
350
350
|
assert_entry("A::H", Entry::Constant, "/fake/path/foo.rb:3-2:3-3")
|
351
|
-
assert_entry("A::I::J", Entry::
|
351
|
+
assert_entry("A::I::J", Entry::UnresolvedConstantAlias, "/fake/path/foo.rb:3-5:3-9")
|
352
352
|
assert_entry("A::K", Entry::Constant, "/fake/path/foo.rb:4-2:4-3")
|
353
353
|
assert_entry("A::L", Entry::Constant, "/fake/path/foo.rb:4-5:4-6")
|
354
354
|
end
|
@@ -181,20 +181,20 @@ module RubyIndexer
|
|
181
181
|
|
182
182
|
def test_resolving_aliases_to_non_existing_constants_with_conflicting_names
|
183
183
|
@index.index_single(IndexablePath.new("/fake", "/fake/path/foo.rb"), <<~RUBY)
|
184
|
-
class
|
184
|
+
class Bar
|
185
185
|
end
|
186
186
|
|
187
187
|
module Foo
|
188
|
-
class
|
189
|
-
|
188
|
+
class Bar < self
|
189
|
+
BAZ = ::Bar::BAZ
|
190
190
|
end
|
191
191
|
end
|
192
192
|
RUBY
|
193
193
|
|
194
|
-
entry = @index.resolve("
|
194
|
+
entry = @index.resolve("BAZ", ["Foo", "Bar"]).first
|
195
195
|
refute_nil(entry)
|
196
196
|
|
197
|
-
assert_instance_of(Entry::
|
197
|
+
assert_instance_of(Entry::UnresolvedConstantAlias, entry)
|
198
198
|
end
|
199
199
|
|
200
200
|
def test_visitor_does_not_visit_unnecessary_nodes
|
@@ -1015,11 +1015,11 @@ module RubyIndexer
|
|
1015
1015
|
|
1016
1016
|
foo_entry = T.must(@index.resolve("FOO", ["Namespace"])&.first)
|
1017
1017
|
assert_equal(2, foo_entry.location.start_line)
|
1018
|
-
assert_instance_of(Entry::
|
1018
|
+
assert_instance_of(Entry::ConstantAlias, foo_entry)
|
1019
1019
|
|
1020
1020
|
bar_entry = T.must(@index.resolve("BAR", ["Namespace"])&.first)
|
1021
1021
|
assert_equal(3, bar_entry.location.start_line)
|
1022
|
-
assert_instance_of(Entry::
|
1022
|
+
assert_instance_of(Entry::ConstantAlias, bar_entry)
|
1023
1023
|
end
|
1024
1024
|
|
1025
1025
|
def test_resolving_circular_alias_three_levels
|
@@ -1033,15 +1033,15 @@ module RubyIndexer
|
|
1033
1033
|
|
1034
1034
|
foo_entry = T.must(@index.resolve("FOO", ["Namespace"])&.first)
|
1035
1035
|
assert_equal(2, foo_entry.location.start_line)
|
1036
|
-
assert_instance_of(Entry::
|
1036
|
+
assert_instance_of(Entry::ConstantAlias, foo_entry)
|
1037
1037
|
|
1038
1038
|
bar_entry = T.must(@index.resolve("BAR", ["Namespace"])&.first)
|
1039
1039
|
assert_equal(3, bar_entry.location.start_line)
|
1040
|
-
assert_instance_of(Entry::
|
1040
|
+
assert_instance_of(Entry::ConstantAlias, bar_entry)
|
1041
1041
|
|
1042
1042
|
baz_entry = T.must(@index.resolve("BAZ", ["Namespace"])&.first)
|
1043
1043
|
assert_equal(4, baz_entry.location.start_line)
|
1044
|
-
assert_instance_of(Entry::
|
1044
|
+
assert_instance_of(Entry::ConstantAlias, baz_entry)
|
1045
1045
|
end
|
1046
1046
|
|
1047
1047
|
def test_resolving_constants_in_aliased_namespace
|
@@ -1765,5 +1765,62 @@ module RubyIndexer
|
|
1765
1765
|
@index.linearized_ancestors_of("A::<Class:A>")
|
1766
1766
|
end
|
1767
1767
|
end
|
1768
|
+
|
1769
|
+
def test_linearizing_singleton_parent_class_with_namespace
|
1770
|
+
index(<<~RUBY)
|
1771
|
+
class ActiveRecord::Base; end
|
1772
|
+
|
1773
|
+
class User < ActiveRecord::Base
|
1774
|
+
end
|
1775
|
+
RUBY
|
1776
|
+
|
1777
|
+
assert_equal(
|
1778
|
+
[
|
1779
|
+
"User::<Class:User>",
|
1780
|
+
"ActiveRecord::Base::<Class:Base>",
|
1781
|
+
"Object::<Class:Object>",
|
1782
|
+
"BasicObject::<Class:BasicObject>",
|
1783
|
+
"Class",
|
1784
|
+
"Module",
|
1785
|
+
"Object",
|
1786
|
+
"Kernel",
|
1787
|
+
"BasicObject",
|
1788
|
+
],
|
1789
|
+
@index.linearized_ancestors_of("User::<Class:User>"),
|
1790
|
+
)
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
def test_singleton_nesting_is_correctly_split_during_linearization
|
1794
|
+
index(<<~RUBY)
|
1795
|
+
module Bar; end
|
1796
|
+
|
1797
|
+
module Foo
|
1798
|
+
class Namespace::Parent
|
1799
|
+
extend Bar
|
1800
|
+
end
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
module Foo
|
1804
|
+
class Child < Namespace::Parent
|
1805
|
+
end
|
1806
|
+
end
|
1807
|
+
RUBY
|
1808
|
+
|
1809
|
+
assert_equal(
|
1810
|
+
[
|
1811
|
+
"Foo::Child::<Class:Child>",
|
1812
|
+
"Foo::Namespace::Parent::<Class:Parent>",
|
1813
|
+
"Bar",
|
1814
|
+
"Object::<Class:Object>",
|
1815
|
+
"BasicObject::<Class:BasicObject>",
|
1816
|
+
"Class",
|
1817
|
+
"Module",
|
1818
|
+
"Object",
|
1819
|
+
"Kernel",
|
1820
|
+
"BasicObject",
|
1821
|
+
],
|
1822
|
+
@index.linearized_ancestors_of("Foo::Child::<Class:Child>"),
|
1823
|
+
)
|
1824
|
+
end
|
1768
1825
|
end
|
1769
1826
|
end
|
@@ -40,6 +40,27 @@ module RubyIndexer
|
|
40
40
|
assert_operator(entry.location.end_column, :>, 0)
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_index_core_constants
|
44
|
+
entries = @index["RUBY_VERSION"]
|
45
|
+
refute_nil(entries)
|
46
|
+
assert_equal(1, entries.length)
|
47
|
+
|
48
|
+
# Complex::I is defined as `Complex::I = ...`
|
49
|
+
entries = @index["Complex::I"]
|
50
|
+
refute_nil(entries)
|
51
|
+
assert_equal(1, entries.length)
|
52
|
+
|
53
|
+
# Encoding::US_ASCII is defined as
|
54
|
+
# ```
|
55
|
+
# module Encoding
|
56
|
+
# US_ASCII = ...
|
57
|
+
# ...
|
58
|
+
# ````
|
59
|
+
entries = @index["Encoding::US_ASCII"]
|
60
|
+
refute_nil(entries)
|
61
|
+
assert_equal(1, entries.length)
|
62
|
+
end
|
63
|
+
|
43
64
|
def test_index_methods
|
44
65
|
entries = @index["initialize"]
|
45
66
|
refute_nil(entries)
|
@@ -310,6 +331,23 @@ module RubyIndexer
|
|
310
331
|
assert_kind_of(Entry::BlockParameter, parameters[3])
|
311
332
|
end
|
312
333
|
|
334
|
+
def test_signature_alias
|
335
|
+
# In RBS, an alias means that two methods have the same signature.
|
336
|
+
# It does not mean the same thing as a Ruby alias.
|
337
|
+
any_entries = @index["any?"]
|
338
|
+
|
339
|
+
assert_equal(["Array", "Enumerable", "Hash"], any_entries.map { _1.owner.name })
|
340
|
+
|
341
|
+
entry = any_entries.find { |entry| entry.owner.name == "Array" }
|
342
|
+
|
343
|
+
assert_kind_of(RubyIndexer::Entry::UnresolvedMethodAlias, entry)
|
344
|
+
assert_equal("any?", entry.name)
|
345
|
+
assert_equal("all?", entry.old_name)
|
346
|
+
assert_equal("Array", entry.owner.name)
|
347
|
+
assert(entry.file_path.end_with?("core/array.rbs"))
|
348
|
+
assert_includes(entry.comments[0], "Returns `true` if any element of `self` meets a given criterion.")
|
349
|
+
end
|
350
|
+
|
313
351
|
private
|
314
352
|
|
315
353
|
def parse_rbs_methods(rbs, method_name)
|
@@ -46,6 +46,7 @@ module RubyLsp
|
|
46
46
|
:on_instance_variable_or_write_node_enter,
|
47
47
|
:on_instance_variable_target_node_enter,
|
48
48
|
:on_string_node_enter,
|
49
|
+
:on_symbol_node_enter,
|
49
50
|
:on_super_node_enter,
|
50
51
|
:on_forwarding_super_node_enter,
|
51
52
|
)
|
@@ -54,9 +55,7 @@ module RubyLsp
|
|
54
55
|
sig { params(node: Prism::CallNode).void }
|
55
56
|
def on_call_node_enter(node)
|
56
57
|
# Sorbet can handle go to definition for methods invoked on self on typed true or higher
|
57
|
-
if (@sorbet_level
|
58
|
-
self_receiver?(node)
|
59
|
-
end
|
58
|
+
return if sorbet_level_true_or_higher?(@sorbet_level) && self_receiver?(node)
|
60
59
|
|
61
60
|
message = node.message
|
62
61
|
return unless message
|
@@ -83,6 +82,17 @@ module RubyLsp
|
|
83
82
|
handle_require_definition(node, name)
|
84
83
|
end
|
85
84
|
|
85
|
+
sig { params(node: Prism::SymbolNode).void }
|
86
|
+
def on_symbol_node_enter(node)
|
87
|
+
enclosing_call = @node_context.call_node
|
88
|
+
return unless enclosing_call
|
89
|
+
|
90
|
+
name = enclosing_call.name
|
91
|
+
return unless name == :autoload
|
92
|
+
|
93
|
+
handle_autoload_definition(enclosing_call)
|
94
|
+
end
|
95
|
+
|
86
96
|
sig { params(node: Prism::BlockArgumentNode).void }
|
87
97
|
def on_block_argument_node_enter(node)
|
88
98
|
expression = node.expression
|
@@ -253,6 +263,17 @@ module RubyLsp
|
|
253
263
|
end
|
254
264
|
end
|
255
265
|
|
266
|
+
sig { params(node: Prism::CallNode).void }
|
267
|
+
def handle_autoload_definition(node)
|
268
|
+
argument = node.arguments&.arguments&.first
|
269
|
+
return unless argument.is_a?(Prism::SymbolNode)
|
270
|
+
|
271
|
+
constant_name = argument.value
|
272
|
+
return unless constant_name
|
273
|
+
|
274
|
+
find_in_index(constant_name)
|
275
|
+
end
|
276
|
+
|
256
277
|
sig { params(value: String).void }
|
257
278
|
def find_in_index(value)
|
258
279
|
entries = @index.resolve(value, @node_context.nesting)
|
@@ -180,7 +180,11 @@ module RubyLsp
|
|
180
180
|
def on_call_node_enter(node)
|
181
181
|
return unless matches?(node, [Prism::CallNode, Prism::DefNode])
|
182
182
|
|
183
|
-
|
183
|
+
loc = node.message_loc
|
184
|
+
# if we have `foo.` it's a call node but there is no message yet.
|
185
|
+
return unless loc
|
186
|
+
|
187
|
+
add_highlight(Constant::DocumentHighlightKind::READ, loc)
|
184
188
|
end
|
185
189
|
|
186
190
|
sig { params(node: Prism::DefNode).void }
|
@@ -89,12 +89,12 @@ module RubyLsp
|
|
89
89
|
when Prism::ClassNode, Prism::ModuleNode
|
90
90
|
nesting << node.constant_path.slice
|
91
91
|
when Prism::SingletonClassNode
|
92
|
-
nesting << "<Class:#{nesting.last}>"
|
92
|
+
nesting << "<Class:#{nesting.flat_map { |n| n.split("::") }.last}>"
|
93
93
|
when Prism::DefNode
|
94
94
|
surrounding_method = node.name.to_s
|
95
95
|
next unless node.receiver.is_a?(Prism::SelfNode)
|
96
96
|
|
97
|
-
nesting << "<Class:#{nesting.last}>"
|
97
|
+
nesting << "<Class:#{nesting.flat_map { |n| n.split("::") }.last}>"
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -25,9 +25,12 @@ module RubyLsp
|
|
25
25
|
class << self
|
26
26
|
extend T::Sig
|
27
27
|
|
28
|
-
sig { returns(Interface::
|
28
|
+
sig { returns(Interface::CodeActionRegistrationOptions) }
|
29
29
|
def provider
|
30
|
-
Interface::
|
30
|
+
Interface::CodeActionRegistrationOptions.new(
|
31
|
+
document_selector: [Interface::DocumentFilter.new(language: "ruby")],
|
32
|
+
resolve_provider: true,
|
33
|
+
)
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
@@ -30,6 +30,12 @@ module RubyLsp
|
|
30
30
|
extend T::Sig
|
31
31
|
extend T::Generic
|
32
32
|
|
33
|
+
SPECIAL_METHOD_CALLS = [
|
34
|
+
:require,
|
35
|
+
:require_relative,
|
36
|
+
:autoload,
|
37
|
+
].freeze
|
38
|
+
|
33
39
|
sig do
|
34
40
|
params(
|
35
41
|
document: Document,
|
@@ -78,8 +84,9 @@ module RubyLsp
|
|
78
84
|
parent,
|
79
85
|
position,
|
80
86
|
)
|
81
|
-
elsif target.is_a?(Prism::CallNode) && target.
|
82
|
-
|
87
|
+
elsif target.is_a?(Prism::CallNode) && !SPECIAL_METHOD_CALLS.include?(target.message) && !covers_position?(
|
88
|
+
target.message_loc, position
|
89
|
+
)
|
83
90
|
# If the target is a method call, we need to ensure that the requested position is exactly on top of the
|
84
91
|
# method identifier. Otherwise, we risk showing definitions for unrelated things
|
85
92
|
target = nil
|
@@ -22,12 +22,13 @@ module RubyLsp
|
|
22
22
|
class << self
|
23
23
|
extend T::Sig
|
24
24
|
|
25
|
-
sig { returns(
|
25
|
+
sig { returns(Interface::DiagnosticRegistrationOptions) }
|
26
26
|
def provider
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
Interface::DiagnosticRegistrationOptions.new(
|
28
|
+
document_selector: [Interface::DocumentFilter.new(language: "ruby")],
|
29
|
+
inter_file_dependencies: false,
|
30
|
+
workspace_diagnostics: false,
|
31
|
+
)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -34,14 +34,9 @@ module RubyLsp
|
|
34
34
|
class << self
|
35
35
|
extend T::Sig
|
36
36
|
|
37
|
-
sig { returns(Interface::
|
37
|
+
sig { returns(Interface::DocumentSymbolOptions) }
|
38
38
|
def provider
|
39
|
-
Interface::
|
40
|
-
hierarchical_document_symbol_support: true,
|
41
|
-
symbol_kind: {
|
42
|
-
value_set: (Constant::SymbolKind::FILE..Constant::SymbolKind::TYPE_PARAMETER).to_a,
|
43
|
-
},
|
44
|
-
)
|
39
|
+
Interface::DocumentSymbolOptions.new
|
45
40
|
end
|
46
41
|
end
|
47
42
|
|
@@ -23,9 +23,13 @@ module RubyLsp
|
|
23
23
|
class << self
|
24
24
|
extend T::Sig
|
25
25
|
|
26
|
-
sig { returns(Interface::
|
26
|
+
sig { returns(Interface::FoldingRangeRegistrationOptions) }
|
27
27
|
def provider
|
28
|
-
Interface::
|
28
|
+
Interface::FoldingRangeRegistrationOptions.new(
|
29
|
+
document_selector: [
|
30
|
+
Interface::DocumentFilter.new(language: "ruby"),
|
31
|
+
],
|
32
|
+
)
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
@@ -27,6 +27,19 @@ module RubyLsp
|
|
27
27
|
|
28
28
|
class Error < StandardError; end
|
29
29
|
|
30
|
+
class << self
|
31
|
+
extend T::Sig
|
32
|
+
|
33
|
+
sig { returns(Interface::DocumentFormattingRegistrationOptions) }
|
34
|
+
def provider
|
35
|
+
Interface::DocumentFormattingRegistrationOptions.new(
|
36
|
+
document_selector: [
|
37
|
+
Interface::DocumentFilter.new(language: "ruby"),
|
38
|
+
],
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
30
43
|
sig { params(global_state: GlobalState, document: Document).void }
|
31
44
|
def initialize(global_state, document)
|
32
45
|
super()
|
@@ -22,9 +22,9 @@ module RubyLsp
|
|
22
22
|
class << self
|
23
23
|
extend T::Sig
|
24
24
|
|
25
|
-
sig { returns(Interface::
|
25
|
+
sig { returns(Interface::HoverOptions) }
|
26
26
|
def provider
|
27
|
-
Interface::
|
27
|
+
Interface::HoverOptions.new
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -21,9 +21,10 @@ module RubyLsp
|
|
21
21
|
class << self
|
22
22
|
extend T::Sig
|
23
23
|
|
24
|
-
sig { returns(Interface::
|
24
|
+
sig { returns(Interface::DocumentOnTypeFormattingRegistrationOptions) }
|
25
25
|
def provider
|
26
|
-
Interface::
|
26
|
+
Interface::DocumentOnTypeFormattingRegistrationOptions.new(
|
27
|
+
document_selector: [Interface::DocumentFilter.new(language: "ruby")],
|
27
28
|
first_trigger_character: "{",
|
28
29
|
more_trigger_character: ["\n", "|", "d"],
|
29
30
|
)
|
@@ -32,8 +33,9 @@ module RubyLsp
|
|
32
33
|
|
33
34
|
END_REGEXES = T.let(
|
34
35
|
[
|
35
|
-
/\b(if|unless|for|while|
|
36
|
-
|
36
|
+
/\b(if|unless|for|while|until)\b($|\s|\()/,
|
37
|
+
/\b(class|module|def|case)\b($|\s)/,
|
38
|
+
/.*\s\bdo\b($|\s)/,
|
37
39
|
],
|
38
40
|
T::Array[Regexp],
|
39
41
|
)
|
data/lib/ruby_lsp/server.rb
CHANGED
@@ -181,6 +181,7 @@ module RubyLsp
|
|
181
181
|
hover_provider = Requests::Hover.provider if enabled_features["hover"]
|
182
182
|
folding_ranges_provider = Requests::FoldingRanges.provider if enabled_features["foldingRanges"]
|
183
183
|
semantic_tokens_provider = Requests::SemanticHighlighting.provider if enabled_features["semanticHighlighting"]
|
184
|
+
document_formatting_provider = Requests::Formatting.provider if enabled_features["formatting"]
|
184
185
|
diagnostics_provider = Requests::Diagnostics.provider if enabled_features["diagnostics"]
|
185
186
|
on_type_formatting_provider = Requests::OnTypeFormatting.provider if enabled_features["onTypeFormatting"]
|
186
187
|
code_action_provider = Requests::CodeActions.provider if enabled_features["codeActions"]
|
@@ -202,7 +203,7 @@ module RubyLsp
|
|
202
203
|
document_link_provider: document_link_provider,
|
203
204
|
folding_range_provider: folding_ranges_provider,
|
204
205
|
semantic_tokens_provider: semantic_tokens_provider,
|
205
|
-
document_formatting_provider:
|
206
|
+
document_formatting_provider: document_formatting_provider && @global_state.formatter != "none",
|
206
207
|
document_highlight_provider: enabled_features["documentHighlights"],
|
207
208
|
code_action_provider: code_action_provider,
|
208
209
|
document_on_type_formatting_provider: on_type_formatting_provider,
|
@@ -421,8 +422,6 @@ module RubyLsp
|
|
421
422
|
|
422
423
|
document = @store.get(uri)
|
423
424
|
|
424
|
-
return send_empty_response(message[:id]) if document.is_a?(ERBDocument)
|
425
|
-
|
426
425
|
response = Requests::Formatting.new(@global_state, document).perform
|
427
426
|
send_message(Result.new(id: message[:id], response: response))
|
428
427
|
rescue Requests::Request::InvalidFormatter => error
|
@@ -448,8 +447,6 @@ module RubyLsp
|
|
448
447
|
params = message[:params]
|
449
448
|
document = @store.get(params.dig(:textDocument, :uri))
|
450
449
|
|
451
|
-
return send_empty_response(message[:id]) if document.is_a?(ERBDocument)
|
452
|
-
|
453
450
|
send_message(
|
454
451
|
Result.new(
|
455
452
|
id: message[:id],
|
@@ -506,8 +503,6 @@ module RubyLsp
|
|
506
503
|
params = message[:params]
|
507
504
|
document = @store.get(params.dig(:textDocument, :uri))
|
508
505
|
|
509
|
-
return send_empty_response(message[:id]) if document.is_a?(ERBDocument)
|
510
|
-
|
511
506
|
send_message(
|
512
507
|
Result.new(
|
513
508
|
id: message[:id],
|
@@ -563,8 +558,6 @@ module RubyLsp
|
|
563
558
|
|
564
559
|
document = @store.get(uri)
|
565
560
|
|
566
|
-
return send_empty_response(message[:id]) if document.is_a?(ERBDocument)
|
567
|
-
|
568
561
|
response = document.cache_fetch("textDocument/diagnostic") do |document|
|
569
562
|
Requests::Diagnostics.new(@global_state, document).perform
|
570
563
|
end
|
@@ -765,8 +758,6 @@ module RubyLsp
|
|
765
758
|
# stuck indexing files
|
766
759
|
Thread.new do
|
767
760
|
begin
|
768
|
-
RubyIndexer::RBSIndexer.new(@global_state.index).index_ruby_core
|
769
|
-
|
770
761
|
@global_state.index.index_all do |percentage|
|
771
762
|
progress("indexing-progress", percentage)
|
772
763
|
true
|
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.17.
|
4
|
+
version: 0.17.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: language_server-protocol
|