git: e43a38d09756 - main - devel/rubygem-ruby-lsp-rails: Allow build with rubygem-ruby-lsp 0.21.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 15 Nov 2024 10:18:21 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e43a38d09756947a42cebec8f347874c40d531c0

commit e43a38d09756947a42cebec8f347874c40d531c0
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-11-15 10:09:51 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-11-15 10:17:15 +0000

    devel/rubygem-ruby-lsp-rails: Allow build with rubygem-ruby-lsp 0.21.0+
    
    - Bump PORTREVISION for package change
    
    Obtained from:  https://github.com/Shopify/ruby-lsp-rails/commit/77650f0303da7bd0ff7ce718721f3fef767e16de
                    https://github.com/Shopify/ruby-lsp-rails/commit/3a01040ac964764cf672c4c59f3b7d92da8f015a
---
 devel/rubygem-ruby-lsp-rails/Makefile             |   3 +-
 devel/rubygem-ruby-lsp-rails/files/patch-ruby-lsp | 128 ++++++++++++++++++++++
 2 files changed, 130 insertions(+), 1 deletion(-)

diff --git a/devel/rubygem-ruby-lsp-rails/Makefile b/devel/rubygem-ruby-lsp-rails/Makefile
index 51fa72b96b9c..8a1c28002cc1 100644
--- a/devel/rubygem-ruby-lsp-rails/Makefile
+++ b/devel/rubygem-ruby-lsp-rails/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ruby-lsp-rails
 PORTVERSION=	0.3.21
+PORTREVISION=	1
 CATEGORIES=	devel rubygems
 MASTER_SITES=	RG
 
@@ -11,7 +12,7 @@ WWW=		https://shopify.github.io/ruby-lsp-rails/ \
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-RUN_DEPENDS=	rubygem-ruby-lsp>=0.20.0<0.21.0:devel/rubygem-ruby-lsp
+RUN_DEPENDS=	rubygem-ruby-lsp>=0.21.2<0.22.0:devel/rubygem-ruby-lsp
 
 USES=		gem
 
diff --git a/devel/rubygem-ruby-lsp-rails/files/patch-ruby-lsp b/devel/rubygem-ruby-lsp-rails/files/patch-ruby-lsp
new file mode 100644
index 000000000000..ddc43ba2304d
--- /dev/null
+++ b/devel/rubygem-ruby-lsp-rails/files/patch-ruby-lsp
@@ -0,0 +1,128 @@
+Obtained from:	https://github.com/Shopify/ruby-lsp-rails/commit/77650f0303da7bd0ff7ce718721f3fef767e16de
+		https://github.com/Shopify/ruby-lsp-rails/commit/3a01040ac964764cf672c4c59f3b7d92da8f015a
+
+--- lib/ruby_lsp/ruby_lsp_rails/addon.rb.orig	2024-11-04 01:43:34 UTC
++++ lib/ruby_lsp/ruby_lsp_rails/addon.rb
+@@ -53,7 +53,7 @@ module RubyLsp
+         @outgoing_queue << Notification.window_log_message("Activating Ruby LSP Rails add-on v#{VERSION}")
+ 
+         register_additional_file_watchers(global_state: global_state, outgoing_queue: outgoing_queue)
+-        @global_state.index.register_enhancement(IndexingEnhancement.new)
++        @global_state.index.register_enhancement(IndexingEnhancement.new(@global_state.index))
+ 
+         # Start booting the real client in a background thread. Until this completes, the client will be a NullClient
+         @client_mutex.unlock
+@@ -128,7 +128,7 @@ module RubyLsp
+ 
+       sig { params(global_state: GlobalState, outgoing_queue: Thread::Queue).void }
+       def register_additional_file_watchers(global_state:, outgoing_queue:)
+-        return unless global_state.supports_watching_files
++        return unless global_state.client_capabilities.supports_watching_files
+ 
+         outgoing_queue << Request.new(
+           id: "ruby-lsp-rails-file-watcher",
+--- lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb.orig	2024-11-04 01:43:34 UTC
++++ lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb
+@@ -3,13 +3,11 @@ module RubyLsp
+ 
+ module RubyLsp
+   module Rails
+-    class IndexingEnhancement
++    class IndexingEnhancement < RubyIndexer::Enhancement
+       extend T::Sig
+-      include RubyIndexer::Enhancement
+ 
+       sig do
+         override.params(
+-          index: RubyIndexer::Index,
+           owner: T.nilable(RubyIndexer::Entry::Namespace),
+           node: Prism::CallNode,
+           file_path: String,
+@@ -19,16 +17,16 @@ module RubyLsp
+           ),
+         ).void
+       end
+-      def on_call_node(index, owner, node, file_path, code_units_cache)
++      def on_call_node_enter(owner, node, file_path, code_units_cache)
+         return unless owner
+ 
+         name = node.name
+ 
+         case name
+         when :extend
+-          handle_concern_extend(index, owner, node)
++          handle_concern_extend(owner, node)
+         when :has_one, :has_many, :belongs_to, :has_and_belongs_to_many
+-          handle_association(index, owner, node, file_path, code_units_cache)
++          handle_association(owner, node, file_path, code_units_cache)
+         end
+       end
+ 
+@@ -36,7 +34,6 @@ module RubyLsp
+ 
+       sig do
+         params(
+-          index: RubyIndexer::Index,
+           owner: RubyIndexer::Entry::Namespace,
+           node: Prism::CallNode,
+           file_path: String,
+@@ -46,7 +43,7 @@ module RubyLsp
+           ),
+         ).void
+       end
+-      def handle_association(index, owner, node, file_path, code_units_cache)
++      def handle_association(owner, node, file_path, code_units_cache)
+         arguments = node.arguments&.arguments
+         return unless arguments
+ 
+@@ -64,7 +61,7 @@ module RubyLsp
+         loc = RubyIndexer::Location.from_prism_location(name_arg.location, code_units_cache)
+ 
+         # Reader
+-        index.add(RubyIndexer::Entry::Method.new(
++        @index.add(RubyIndexer::Entry::Method.new(
+           name,
+           file_path,
+           loc,
+@@ -76,7 +73,7 @@ module RubyLsp
+         ))
+ 
+         # Writer
+-        index.add(RubyIndexer::Entry::Method.new(
++        @index.add(RubyIndexer::Entry::Method.new(
+           "#{name}=",
+           file_path,
+           loc,
+@@ -90,12 +87,11 @@ module RubyLsp
+ 
+       sig do
+         params(
+-          index: RubyIndexer::Index,
+           owner: RubyIndexer::Entry::Namespace,
+           node: Prism::CallNode,
+         ).void
+       end
+-      def handle_concern_extend(index, owner, node)
++      def handle_concern_extend(owner, node)
+         arguments = node.arguments&.arguments
+         return unless arguments
+ 
+@@ -105,7 +101,7 @@ module RubyLsp
+           module_name = node.full_name
+           next unless module_name == "ActiveSupport::Concern"
+ 
+-          index.register_included_hook(owner.name) do |index, base|
++          @index.register_included_hook(owner.name) do |index, base|
+             class_methods_name = "#{owner.name}::ClassMethods"
+ 
+             if index.indexed?(class_methods_name)
+--- ruby-lsp-rails.gemspec.orig	2024-11-04 01:43:34 UTC
++++ ruby-lsp-rails.gemspec
+@@ -21,6 +21,6 @@ Gem::Specification.new do |s|
+ 
+   s.specification_version = 4
+ 
+-  s.add_runtime_dependency(%q<ruby-lsp>.freeze, [">= 0.20.0".freeze, "< 0.21.0".freeze])
++  s.add_runtime_dependency(%q<ruby-lsp>.freeze, [">= 0.21.2".freeze, "< 0.22.0".freeze])
+ end
+