Skip to content

Commit

Permalink
Ruby 3.4.1 compatability (#735)
Browse files Browse the repository at this point in the history
* Add logger and observer as explicit dependencies

* Add explicit rake dependency

* Add nil handling to node_range method

* Add explicit ostruct dependency

* Update deprecated JaroWinkler distance method

---------

Co-authored-by: 12ball <[email protected]>
  • Loading branch information
janie314 and 12ball authored Jan 7, 2025
1 parent e781533 commit d0934b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/solargraph/parser/rubyvm/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ def is_ast_node? node
end

def node_range node
if node.nil?
nil
else
st = Position.new(node.first_lineno - 1, node.first_column)
en = Position.new(node.last_lineno - 1, node.last_column)
Range.new(st, en)
end
end

def recipient_node tree
Expand Down
2 changes: 1 addition & 1 deletion lib/solargraph/pin/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def do_query
# @return [Float]
def fuzzy_string_match str1, str2
return (1.0 + (str2.length.to_f / str1.length.to_f)) if str1.downcase.include?(str2.downcase)
JaroWinkler.distance(str1, str2, ignore_case: true)
JaroWinkler.similarity(str1, str2, ignore_case: true)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions solargraph.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'diff-lcs', '~> 1.4'
s.add_runtime_dependency 'e2mmap'
s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
s.add_runtime_dependency 'logger', '~> 1.6'
s.add_runtime_dependency 'kramdown', '~> 2.3'
s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1'
s.add_runtime_dependency 'observer', '~> 0.1'
s.add_runtime_dependency 'ostruct', '~> 0.6'
s.add_runtime_dependency 'parser', '~> 3.0'
s.add_runtime_dependency 'rbs', '~> 2.0'
s.add_runtime_dependency 'reverse_markdown', '~> 2.0'
Expand All @@ -41,6 +44,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'pry'
s.add_development_dependency 'public_suffix', '~> 3.1'
s.add_development_dependency 'rake', '~> 13.2'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'simplecov', '~> 0.14'
s.add_development_dependency 'webmock', '~> 3.6'
Expand Down

0 comments on commit d0934b8

Please sign in to comment.