Skip to content

Commit 1b85c99

Browse files
committed
Update ruby-lsp dependency
1 parent b5f4791 commit 1b85c99

File tree

7 files changed

+442
-372
lines changed

7 files changed

+442
-372
lines changed

Gemfile.lock

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PATH
22
remote: .
33
specs:
44
ruby-lsp-rails (0.3.21)
5-
ruby-lsp (>= 0.20.0, < 0.21.0)
5+
ruby-lsp (>= 0.21.0, < 0.22.0)
66

77
GEM
88
remote: https://rubygems.org/
@@ -135,8 +135,6 @@ GEM
135135
nio4r (2.7.3)
136136
nokogiri (1.16.7-arm64-darwin)
137137
racc (~> 1.4)
138-
nokogiri (1.16.7-x64-mingw-ucrt)
139-
racc (~> 1.4)
140138
nokogiri (1.16.7-x86_64-darwin)
141139
racc (~> 1.4)
142140
nokogiri (1.16.7-x86_64-linux)
@@ -224,7 +222,7 @@ GEM
224222
rubocop (~> 1.51)
225223
rubocop-sorbet (0.8.3)
226224
rubocop (>= 0.90.0)
227-
ruby-lsp (0.20.0)
225+
ruby-lsp (0.21.0)
228226
language_server-protocol (~> 3.17.0)
229227
prism (>= 1.2, < 2.0)
230228
rbs (>= 3, < 4)
@@ -246,7 +244,6 @@ GEM
246244
sorbet-static-and-runtime (>= 0.5.10187)
247245
thor (>= 0.19.2)
248246
sqlite3 (2.1.0-arm64-darwin)
249-
sqlite3 (2.1.0-x64-mingw-ucrt)
250247
sqlite3 (2.1.0-x86_64-darwin)
251248
sqlite3 (2.1.0-x86_64-linux-gnu)
252249
stringio (3.1.1)
@@ -284,7 +281,6 @@ GEM
284281

285282
PLATFORMS
286283
arm64-darwin
287-
x64-mingw-ucrt
288284
x86_64-darwin
289285
x86_64-linux
290286

lib/ruby_lsp/ruby_lsp_rails/addon.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def activate(global_state, outgoing_queue)
5353
@outgoing_queue << Notification.window_log_message("Activating Ruby LSP Rails add-on v#{VERSION}")
5454

5555
register_additional_file_watchers(global_state: global_state, outgoing_queue: outgoing_queue)
56-
@global_state.index.register_enhancement(IndexingEnhancement.new)
56+
@global_state.index.register_enhancement(IndexingEnhancement.new(@global_state.index))
5757

5858
# Start booting the real client in a background thread. Until this completes, the client will be a NullClient
5959
@client_mutex.unlock
@@ -128,7 +128,7 @@ def workspace_did_change_watched_files(changes)
128128

129129
sig { params(global_state: GlobalState, outgoing_queue: Thread::Queue).void }
130130
def register_additional_file_watchers(global_state:, outgoing_queue:)
131-
return unless global_state.supports_watching_files
131+
return unless global_state.client_capabilities.supports_watching_files
132132

133133
outgoing_queue << Request.new(
134134
id: "ruby-lsp-rails-file-watcher",

lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
module RubyLsp
55
module Rails
6-
class IndexingEnhancement
6+
class IndexingEnhancement < RubyIndexer::Enhancement
77
extend T::Sig
8-
include RubyIndexer::Enhancement
8+
9+
sig { params(index: RubyIndexer::Index).void }
10+
def initialize(index)
11+
super
12+
@index = index
13+
end
914

1015
sig do
1116
override.params(
12-
index: RubyIndexer::Index,
1317
owner: T.nilable(RubyIndexer::Entry::Namespace),
1418
node: Prism::CallNode,
1519
file_path: String,
@@ -19,24 +23,23 @@ class IndexingEnhancement
1923
),
2024
).void
2125
end
22-
def on_call_node(index, owner, node, file_path, code_units_cache)
26+
def on_call_node_enter(owner, node, file_path, code_units_cache)
2327
return unless owner
2428

2529
name = node.name
2630

2731
case name
2832
when :extend
29-
handle_concern_extend(index, owner, node)
33+
handle_concern_extend(owner, node)
3034
when :has_one, :has_many, :belongs_to, :has_and_belongs_to_many
31-
handle_association(index, owner, node, file_path, code_units_cache)
35+
handle_association(owner, node, file_path, code_units_cache)
3236
end
3337
end
3438

3539
private
3640

3741
sig do
3842
params(
39-
index: RubyIndexer::Index,
4043
owner: RubyIndexer::Entry::Namespace,
4144
node: Prism::CallNode,
4245
file_path: String,
@@ -46,7 +49,7 @@ def on_call_node(index, owner, node, file_path, code_units_cache)
4649
),
4750
).void
4851
end
49-
def handle_association(index, owner, node, file_path, code_units_cache)
52+
def handle_association(owner, node, file_path, code_units_cache)
5053
arguments = node.arguments&.arguments
5154
return unless arguments
5255

@@ -64,7 +67,7 @@ def handle_association(index, owner, node, file_path, code_units_cache)
6467
loc = RubyIndexer::Location.from_prism_location(name_arg.location, code_units_cache)
6568

6669
# Reader
67-
index.add(RubyIndexer::Entry::Method.new(
70+
@index.add(RubyIndexer::Entry::Method.new(
6871
name,
6972
file_path,
7073
loc,
@@ -76,7 +79,7 @@ def handle_association(index, owner, node, file_path, code_units_cache)
7679
))
7780

7881
# Writer
79-
index.add(RubyIndexer::Entry::Method.new(
82+
@index.add(RubyIndexer::Entry::Method.new(
8083
"#{name}=",
8184
file_path,
8285
loc,
@@ -90,12 +93,11 @@ def handle_association(index, owner, node, file_path, code_units_cache)
9093

9194
sig do
9295
params(
93-
index: RubyIndexer::Index,
9496
owner: RubyIndexer::Entry::Namespace,
9597
node: Prism::CallNode,
9698
).void
9799
end
98-
def handle_concern_extend(index, owner, node)
100+
def handle_concern_extend(owner, node)
99101
arguments = node.arguments&.arguments
100102
return unless arguments
101103

@@ -105,7 +107,7 @@ def handle_concern_extend(index, owner, node)
105107
module_name = node.full_name
106108
next unless module_name == "ActiveSupport::Concern"
107109

108-
index.register_included_hook(owner.name) do |index, base|
110+
@index.register_included_hook(owner.name) do |index, base|
109111
class_methods_name = "#{owner.name}::ClassMethods"
110112

111113
if index.indexed?(class_methods_name)

ruby-lsp-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
2424
Dir["lib/**/*", "LICENSE.txt", "Rakefile", "README.md"]
2525
end
2626

27-
spec.add_dependency("ruby-lsp", ">= 0.20.0", "< 0.21.0")
27+
spec.add_dependency("ruby-lsp", ">= 0.21.0", "< 0.22.0")
2828
end

sorbet/rbi/gems/[email protected]

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)