Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 May 2024 17:35:54 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: 60e289a279a1 - main - devel/rubygem-ruby-lsp: Update to 0.16.6
Message-ID:  <202405191735.44JHZsM1000644@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=60e289a279a16d4ded7b5fe69d432ada5eb41d11

commit 60e289a279a16d4ded7b5fe69d432ada5eb41d11
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-05-19 16:26:17 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-05-19 17:18:06 +0000

    devel/rubygem-ruby-lsp: Update to 0.16.6
    
    - Allow build with rubygem-prism 0.29.0
    
    Changes:        https://github.com/Shopify/ruby-lsp/releases
    Obtained from:  https://github.com/Shopify/ruby-lsp/commit/e3c0f201239b56f47c5c6bdd3d034ea6b0bda5f9
                    https://github.com/Shopify/ruby-lsp/commit/70f7d59827d4e6c0c8c9ebb3aa85e0bdc07e25e2
---
 devel/rubygem-ruby-lsp/Makefile            |   5 +-
 devel/rubygem-ruby-lsp/distinfo            |   6 +-
 devel/rubygem-ruby-lsp/files/patch-gemspec |   9 +-
 devel/rubygem-ruby-lsp/files/patch-prism   | 215 +++++++++++++++++++----------
 4 files changed, 156 insertions(+), 79 deletions(-)

diff --git a/devel/rubygem-ruby-lsp/Makefile b/devel/rubygem-ruby-lsp/Makefile
index 74031bb8cf80..51551b245d06 100644
--- a/devel/rubygem-ruby-lsp/Makefile
+++ b/devel/rubygem-ruby-lsp/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	ruby-lsp
-PORTVERSION=	0.16.4
-PORTREVISION=	1
+PORTVERSION=	0.16.6
 CATEGORIES=	devel rubygems
 MASTER_SITES=	RG
 
@@ -13,7 +12,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.27:textproc/rubygem-prism \
+		rubygem-prism>=0.29.0<0.30:textproc/rubygem-prism \
 		rubygem-sorbet-runtime>=0.5.10782:devel/rubygem-sorbet-runtime
 
 USES=		gem
diff --git a/devel/rubygem-ruby-lsp/distinfo b/devel/rubygem-ruby-lsp/distinfo
index 22f54338ab49..2631626f934a 100644
--- a/devel/rubygem-ruby-lsp/distinfo
+++ b/devel/rubygem-ruby-lsp/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1713001208
-SHA256 (rubygem/ruby-lsp-0.16.4.gem) = 0120fb411469230019c8eaf16a0ec3e075f7a3b3acb87e1f67388b99ee9b248e
-SIZE (rubygem/ruby-lsp-0.16.4.gem) = 86016
+TIMESTAMP = 1715843722
+SHA256 (rubygem/ruby-lsp-0.16.6.gem) = eefd337ca6ff51b5ccf8a6b82161fde1477a36e75d78295ad6294318db5495cc
+SIZE (rubygem/ruby-lsp-0.16.6.gem) = 87040
diff --git a/devel/rubygem-ruby-lsp/files/patch-gemspec b/devel/rubygem-ruby-lsp/files/patch-gemspec
index c2bad8bc2a23..819f6170860f 100644
--- a/devel/rubygem-ruby-lsp/files/patch-gemspec
+++ b/devel/rubygem-ruby-lsp/files/patch-gemspec
@@ -1,11 +1,14 @@
---- ruby-lsp.gemspec.orig	2024-04-06 18:29:06 UTC
+Obtained from:	https://github.com/Shopify/ruby-lsp/commit/e3c0f201239b56f47c5c6bdd3d034ea6b0bda5f9
+		https://github.com/Shopify/ruby-lsp/commit/70f7d59827d4e6c0c8c9ebb3aa85e0bdc07e25e2
+
+--- ruby-lsp.gemspec.orig	2024-05-17 18:30:23 UTC
 +++ ruby-lsp.gemspec
 @@ -24,7 +24,7 @@ Gem::Specification.new do |s|
    s.specification_version = 4
  
    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.27".freeze])
+-  s.add_runtime_dependency(%q<prism>.freeze, [">= 0.23.0".freeze, "< 0.28".freeze])
++  s.add_runtime_dependency(%q<prism>.freeze, [">= 0.29.0".freeze, "< 0.30".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
index 509624b3c918..f41efbe1ce42 100644
--- a/devel/rubygem-ruby-lsp/files/patch-prism
+++ b/devel/rubygem-ruby-lsp/files/patch-prism
@@ -1,81 +1,156 @@
-Obtained from:	https://github.com/Shopify/ruby-lsp/pull/1953
+Obtained from:	https://github.com/Shopify/ruby-lsp/commit/e3c0f201239b56f47c5c6bdd3d034ea6b0bda5f9
 
---- 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
+--- lib/core_ext/uri.rb.orig	2024-05-17 18:30:23 UTC
++++ lib/core_ext/uri.rb
+@@ -11,6 +11,9 @@ module URI
+         # On Windows, if the path begins with the disk name, we need to add a leading slash to make it a valid URI
+         escaped_path = if /^[A-Z]:/i.match?(path)
+           DEFAULT_PARSER.escape("/#{path}")
++        elsif path.start_with?("//?/")
++          # Some paths on Windows start with "//?/". This is a special prefix that allows for long file paths
++          DEFAULT_PARSER.escape(path.delete_prefix("//?"))
+         else
+           DEFAULT_PARSER.escape(path)
+         end
+--- lib/ruby_lsp/listeners/document_highlight.rb.orig	2024-05-17 18:30:23 UTC
++++ lib/ruby_lsp/listeners/document_highlight.rb
+@@ -271,7 +271,7 @@ module RubyLsp
+       def on_constant_path_node_enter(node)
+         return unless matches?(node, CONSTANT_PATH_NODES)
  
-     LEAVE_EVENT = T.let(Object.new.freeze, Object)
+-        add_highlight(Constant::DocumentHighlightKind::READ, node.location)
++        add_highlight(Constant::DocumentHighlightKind::READ, node.name_loc)
+       end
  
--    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 { params(node: Prism::ConstantReadNode).void }
+--- lib/ruby_lsp/listeners/document_link.rb.orig	2024-05-17 18:30:23 UTC
++++ lib/ruby_lsp/listeners/document_link.rb
+@@ -30,7 +30,7 @@ module RubyLsp
+                 lookup[spec.name] = {}
+                 lookup[spec.name][spec.version.to_s] = {}
  
--    sig { abstract.returns(Prism::ParseResult) }
-+    sig { abstract.returns(Prism::ParseResult[Prism::ProgramNode]) }
-     def parse; end
+-                Dir.glob("**/*.rb", base: "#{spec.full_gem_path}/").each do |path|
++                Dir.glob("**/*.rb", base: "#{spec.full_gem_path.delete_prefix("//?/")}/").each do |path|
+                   lookup[spec.name][spec.version.to_s][path] = "#{spec.full_gem_path}/#{path}"
+                 end
+               end
+--- lib/ruby_lsp/listeners/semantic_highlighting.rb.orig	2024-05-17 18:30:23 UTC
++++ lib/ruby_lsp/listeners/semantic_highlighting.rb
+@@ -58,6 +58,7 @@ module RubyLsp
+           :on_constant_operator_write_node_enter,
+           :on_constant_or_write_node_enter,
+           :on_constant_target_node_enter,
++          :on_constant_path_node_enter,
+           :on_local_variable_and_write_node_enter,
+           :on_local_variable_operator_write_node_enter,
+           :on_local_variable_or_write_node_enter,
+@@ -302,17 +303,64 @@ module RubyLsp
+       def on_class_node_enter(node)
+         return unless visible?(node, @range)
  
-     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"
+-        @response_builder.add_token(node.constant_path.location, :class, [:declaration])
++        constant_path = node.constant_path
  
-+# 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
++        if constant_path.is_a?(Prism::ConstantReadNode)
++          @response_builder.add_token(constant_path.location, :class, [:declaration])
++        else
++          each_constant_path_part(constant_path) do |part|
++            loc = case part
++            when Prism::ConstantPathNode
++              part.name_loc
++            when Prism::ConstantReadNode
++              part.location
++            end
++            next unless loc
 +
- 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
++            @response_builder.add_token(loc, :class, [:declaration])
++          end
++        end
++
+         superclass = node.superclass
+-        @response_builder.add_token(superclass.location, :class) if superclass
++
++        if superclass.is_a?(Prism::ConstantReadNode)
++          @response_builder.add_token(superclass.location, :class)
++        elsif superclass
++          each_constant_path_part(superclass) do |part|
++            loc = case part
++            when Prism::ConstantPathNode
++              part.name_loc
++            when Prism::ConstantReadNode
++              part.location
++            end
++            next unless loc
++
++            @response_builder.add_token(loc, :class)
++          end
++        end
+       end
  
--        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?
+       sig { params(node: Prism::ModuleNode).void }
+       def on_module_node_enter(node)
+         return unless visible?(node, @range)
  
---- 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
+-        @response_builder.add_token(node.constant_path.location, :namespace, [:declaration])
++        constant_path = node.constant_path
++
++        if constant_path.is_a?(Prism::ConstantReadNode)
++          @response_builder.add_token(constant_path.location, :namespace, [:declaration])
++        else
++          each_constant_path_part(constant_path) do |part|
++            loc = case part
++            when Prism::ConstantPathNode
++              part.name_loc
++            when Prism::ConstantReadNode
++              part.location
++            end
++            next unless loc
++
++            @response_builder.add_token(loc, :namespace, [:declaration])
++          end
++        end
+       end
  
- 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
+       sig { params(node: Prism::ImplicitNode).void }
+@@ -325,6 +373,14 @@ module RubyLsp
+       sig { params(node: Prism::ImplicitNode).void }
+       def on_implicit_node_leave(node)
+         @inside_implicit_node = false
++      end
++
++      sig { params(node: Prism::ConstantPathNode).void }
++      def on_constant_path_node_enter(node)
++        return if @inside_implicit_node
++        return unless visible?(node, @range)
++
++        @response_builder.add_token(node.name_loc, :namespace)
+       end
  
+       private
+--- lib/ruby_lsp/requests/support/common.rb.orig	2024-05-17 18:30:23 UTC
++++ lib/ruby_lsp/requests/support/common.rb
+@@ -167,6 +167,24 @@ module RubyLsp
+             constant_name(path)
+           end
+         end
++
++        # Iterates over each part of a constant path, so that we can easily push response items for each section of the
++        # name. For example, for `Foo::Bar::Baz`, this method will invoke the block with `Foo`, then `Bar` and finally
++        # `Baz`.
++        sig do
++          params(
++            node: Prism::Node,
++            block: T.proc.params(part: Prism::Node).void,
++          ).void
++        end
++        def each_constant_path_part(node, &block)
++          current = T.let(node, T.nilable(Prism::Node))
++
++          while current.is_a?(Prism::ConstantPathNode)
++            block.call(current)
++            current = current.parent
++          end
++        end
+       end
+     end
+   end



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