Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Apr 2024 18:31:58 GMT
From:      Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 578c49b96a2d - main - devel/rubygem-ruby-lsp: Allow build with rubygem-prism 0.26.0
Message-ID:  <202404201831.43KIVwbb034374@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet:

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

commit 578c49b96a2d8c8f875455b232c6995afb8c73e0
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-04-20 18:28:59 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-04-20 18:28:59 +0000

    devel/rubygem-ruby-lsp: Allow build with rubygem-prism 0.26.0
    
    - Bump PORTREVISION for package change
    
    Obtained from:  https://github.com/Shopify/ruby-lsp/pull/1953
---
 devel/rubygem-ruby-lsp/Makefile            |  3 +-
 devel/rubygem-ruby-lsp/files/patch-gemspec |  2 +-
 devel/rubygem-ruby-lsp/files/patch-prism   | 81 ++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/devel/rubygem-ruby-lsp/Makefile b/devel/rubygem-ruby-lsp/Makefile
index 7fefc8d0ea96..74031bb8cf80 100644
--- a/devel/rubygem-ruby-lsp/Makefile
+++ b/devel/rubygem-ruby-lsp/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ruby-lsp
 PORTVERSION=	0.16.4
+PORTREVISION=	1
 CATEGORIES=	devel rubygems
 MASTER_SITES=	RG
 
@@ -12,7 +13,7 @@ LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
 RUN_DEPENDS=	rubygem-language_server-protocol>=3.17.0<3.18:devel/rubygem-language_server-protocol \
-		rubygem-prism>=0.22.0<0.26:textproc/rubygem-prism \
+		rubygem-prism>=0.22.0<0.27:textproc/rubygem-prism \
 		rubygem-sorbet-runtime>=0.5.10782:devel/rubygem-sorbet-runtime
 
 USES=		gem
diff --git a/devel/rubygem-ruby-lsp/files/patch-gemspec b/devel/rubygem-ruby-lsp/files/patch-gemspec
index 38b30beeb0b3..c2bad8bc2a23 100644
--- a/devel/rubygem-ruby-lsp/files/patch-gemspec
+++ b/devel/rubygem-ruby-lsp/files/patch-gemspec
@@ -5,7 +5,7 @@
  
    s.add_runtime_dependency(%q<language_server-protocol>.freeze, ["~> 3.17.0".freeze])
 -  s.add_runtime_dependency(%q<prism>.freeze, [">= 0.22.0".freeze, "< 0.25".freeze])
-+  s.add_runtime_dependency(%q<prism>.freeze, [">= 0.22.0".freeze, "< 0.26".freeze])
++  s.add_runtime_dependency(%q<prism>.freeze, [">= 0.22.0".freeze, "< 0.27".freeze])
    s.add_runtime_dependency(%q<sorbet-runtime>.freeze, [">= 0.5.10782".freeze])
  end
  
diff --git a/devel/rubygem-ruby-lsp/files/patch-prism b/devel/rubygem-ruby-lsp/files/patch-prism
new file mode 100644
index 000000000000..509624b3c918
--- /dev/null
+++ b/devel/rubygem-ruby-lsp/files/patch-prism
@@ -0,0 +1,81 @@
+Obtained from:	https://github.com/Shopify/ruby-lsp/pull/1953
+
+--- lib/ruby_indexer/lib/ruby_indexer/collector.rb.orig	2024-04-20 14:51:21 UTC
++++ lib/ruby_indexer/lib/ruby_indexer/collector.rb
+@@ -7,7 +7,7 @@ module RubyIndexer
+ 
+     LEAVE_EVENT = T.let(Object.new.freeze, Object)
+ 
+-    sig { params(index: Index, parse_result: Prism::ParseResult, file_path: String).void }
++    sig { params(index: Index, parse_result: Prism::ParseResult[Prism::ProgramNode], file_path: String).void }
+     def initialize(index, parse_result, file_path)
+       @index = index
+       @file_path = file_path
+--- lib/ruby_lsp/document.rb.orig	2024-04-20 14:51:21 UTC
++++ lib/ruby_lsp/document.rb
+@@ -8,7 +8,7 @@ module RubyLsp
+ 
+     abstract!
+ 
+-    sig { returns(Prism::ParseResult) }
++    sig { returns(Prism::ParseResult[Prism::ProgramNode]) }
+     attr_reader :parse_result
+ 
+     sig { returns(String) }
+@@ -31,7 +31,7 @@ module RubyLsp
+       @version = T.let(version, Integer)
+       @uri = T.let(uri, URI::Generic)
+       @needs_parsing = T.let(true, T::Boolean)
+-      @parse_result = T.let(parse, Prism::ParseResult)
++      @parse_result = T.let(parse, Prism::ParseResult[Prism::ProgramNode])
+     end
+ 
+     sig { returns(Prism::ProgramNode) }
+@@ -93,7 +93,7 @@ module RubyLsp
+       @cache.clear
+     end
+ 
+-    sig { abstract.returns(Prism::ParseResult) }
++    sig { abstract.returns(Prism::ParseResult[Prism::ProgramNode]) }
+     def parse; end
+ 
+     sig { returns(T::Boolean) }
+--- lib/ruby_lsp/internal.rb.orig	2024-04-20 14:51:21 UTC
++++ lib/ruby_lsp/internal.rb
+@@ -19,6 +19,14 @@ require "language_server-protocol"
+ require "prism/visitor"
+ require "language_server-protocol"
+ 
++# Prism v0.26.0 introduced generics for ParseResult, but it causes some problems so the intention is to remove it.
++# Once that is done, we can remove this patch.
++module Prism
++  class ParseResult
++    extend T::Generic
++  end
++end
++
+ require "ruby-lsp"
+ require "ruby_lsp/base_server"
+ require "ruby_indexer/ruby_indexer"
+--- lib/ruby_lsp/listeners/document_link.rb.orig	2024-04-20 14:51:21 UTC
++++ lib/ruby_lsp/listeners/document_link.rb
+@@ -124,7 +124,7 @@ module RubyLsp
+         match = comment.location.slice.match(%r{source://.*#\d+$})
+         return unless match
+ 
+-        uri = T.cast(URI(T.must(match[0])), URI::Source)
++        uri = T.cast(URI(match[0]), URI::Source)
+         gem_version = resolve_version(uri)
+         return if gem_version.nil?
+ 
+--- lib/ruby_lsp/ruby_document.rb.orig	2024-04-20 14:51:21 UTC
++++ lib/ruby_lsp/ruby_document.rb
+@@ -3,7 +3,7 @@ module RubyLsp
+ 
+ module RubyLsp
+   class RubyDocument < Document
+-    sig { override.returns(Prism::ParseResult) }
++    sig { override.returns(Prism::ParseResult[Prism::ProgramNode]) }
+     def parse
+       return @parse_result unless @needs_parsing
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404201831.43KIVwbb034374>