Skip to content

Commit

Permalink
Bump ruby-lsp support to 0.22.0 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Nov 27, 2024
1 parent 0da0abf commit 07d3f0c
Show file tree
Hide file tree
Showing 18 changed files with 4,518 additions and 3,156 deletions.
46 changes: 24 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
ruby-lsp-rspec (0.1.18)
ruby-lsp (~> 0.21.0)
ruby-lsp (~> 0.22.0)

GEM
remote: https://rubygems.org/
Expand All @@ -17,16 +17,16 @@ GEM
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.5)
json (2.8.2)
language_server-protocol (3.17.0.3)
logger (1.6.1)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.5.1)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
prism (1.2.0)
psych (5.1.2)
psych (5.2.0)
stringio
racc (1.8.1)
rainbow (3.1.1)
Expand All @@ -36,10 +36,10 @@ GEM
sorbet-runtime (>= 0.5.9204)
rbs (3.6.1)
logger
rdoc (6.7.0)
rdoc (6.8.1)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.10)
reline (0.5.11)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand All @@ -54,45 +54,45 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.68.0)
rubocop (1.69.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
rubocop-ast (>= 1.36.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.33.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop-sorbet (0.8.7)
rubocop (>= 1)
ruby-lsp (0.21.2)
ruby-lsp (0.22.1)
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
ruby-progressbar (1.13.0)
sorbet (0.5.11633)
sorbet-static (= 0.5.11633)
sorbet-runtime (0.5.11633)
sorbet-static (0.5.11633-universal-darwin)
sorbet-static (0.5.11633-x86_64-linux)
sorbet-static-and-runtime (0.5.11633)
sorbet (= 0.5.11633)
sorbet-runtime (= 0.5.11633)
sorbet (0.5.11670)
sorbet-static (= 0.5.11670)
sorbet-runtime (0.5.11670)
sorbet-static (0.5.11670-universal-darwin)
sorbet-static (0.5.11670-x86_64-linux)
sorbet-static-and-runtime (0.5.11670)
sorbet (= 0.5.11670)
sorbet-runtime (= 0.5.11670)
spoom (1.5.0)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stringio (3.1.1)
tapioca (0.16.3)
stringio (3.1.2)
tapioca (0.16.5)
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
Expand All @@ -102,7 +102,9 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.3.2)
unicode-display_width (2.6.0)
unicode-display_width (3.1.2)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
Expand Down
1 change: 0 additions & 1 deletion lib/ruby_lsp/ruby_lsp_rspec/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Addon < ::RubyLsp::Addon
sig { override.params(global_state: GlobalState, message_queue: Thread::Queue).void }
def activate(global_state, message_queue)
@index = T.let(global_state.index, T.nilable(RubyIndexer::Index))
global_state.index.register_enhancement(IndexingEnhancement.new(global_state.index))
end

sig { override.void }
Expand Down
36 changes: 4 additions & 32 deletions lib/ruby_lsp/ruby_lsp_rspec/indexing_enhancement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@ module RSpec
class IndexingEnhancement < RubyIndexer::Enhancement
extend T::Sig

sig do
override.params(
owner: T.nilable(RubyIndexer::Entry::Namespace),
node: Prism::CallNode,
file_path: String,
code_units_cache: T.any(
T.proc.params(arg0: Integer).returns(Integer),
Prism::CodeUnitsCache,
),
).void
end
def on_call_node_enter(owner, node, file_path, code_units_cache)
sig { override.params(node: Prism::CallNode).void }
def on_call_node_enter(node)
return if node.receiver

name = node.name
Expand All @@ -43,16 +33,7 @@ def on_call_node_enter(owner, node, file_path, code_units_cache)

return unless method_name

@index.add(RubyIndexer::Entry::Method.new(
method_name,
file_path,
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
nil,
[RubyIndexer::Entry::Signature.new([])],
RubyIndexer::Entry::Visibility::PUBLIC,
owner,
))
@listener.add_method(method_name, block_node.location, [RubyIndexer::Entry::Signature.new([])])
when :subject, :subject!
block_node = node.block
return unless block_node
Expand All @@ -76,16 +57,7 @@ def on_call_node_enter(owner, node, file_path, code_units_cache)

return unless method_name

@index.add(RubyIndexer::Entry::Method.new(
method_name,
file_path,
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
nil,
[RubyIndexer::Entry::Signature.new([])],
RubyIndexer::Entry::Visibility::PUBLIC,
owner,
))
@listener.add_method(method_name, block_node.location, [RubyIndexer::Entry::Signature.new([])])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion ruby-lsp-rspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "ruby-lsp", "~> 0.21.0"
spec.add_dependency "ruby-lsp", "~> 0.22.0"
end
Loading

0 comments on commit 07d3f0c

Please sign in to comment.