From c54b0fb81083dc880149617a06e11b06ec4ddd23 Mon Sep 17 00:00:00 2001 From: "NotFounds(Iori IKEDA)" Date: Tue, 24 Sep 2024 17:56:19 +0900 Subject: [PATCH 1/4] Add test for indexing multibyte characters --- lib/ruby_indexer/test/classes_and_modules_test.rb | 11 +++++++++++ lib/ruby_indexer/test/constant_test.rb | 8 ++++++++ lib/ruby_indexer/test/instance_variables_test.rb | 12 ++++++++++++ lib/ruby_indexer/test/method_test.rb | 10 ++++++++++ 4 files changed, 41 insertions(+) diff --git a/lib/ruby_indexer/test/classes_and_modules_test.rb b/lib/ruby_indexer/test/classes_and_modules_test.rb index a7a7cb02e..de062a738 100644 --- a/lib/ruby_indexer/test/classes_and_modules_test.rb +++ b/lib/ruby_indexer/test/classes_and_modules_test.rb @@ -159,6 +159,17 @@ module Bar assert_entry("Foo::Bar", Entry::Module, "/fake/path/foo.rb:4-2:5-5") end + def test_nested_modules_and_classes_with_multibyte_characters + index(<<~RUBY) + module A動物 + class Bねこ; end + end + RUBY + + assert_entry("A動物", Entry::Module, "/fake/path/foo.rb:0-0:2-3") + assert_entry("A動物::Bねこ", Entry::Class, "/fake/path/foo.rb:1-2:1-16") + end + def test_nested_modules_and_classes index(<<~RUBY) module Foo diff --git a/lib/ruby_indexer/test/constant_test.rb b/lib/ruby_indexer/test/constant_test.rb index 7e95d640b..cf0f83329 100644 --- a/lib/ruby_indexer/test/constant_test.rb +++ b/lib/ruby_indexer/test/constant_test.rb @@ -21,6 +21,14 @@ class ::Bar assert_entry("BAR", Entry::Constant, "/fake/path/foo.rb:6-0:6-7") end + def test_constant_with_multibyte_characters + index(<<~RUBY) + CONST_💎 = "Ruby" + RUBY + + assert_entry("CONST_💎", Entry::Constant, "/fake/path/foo.rb:0-0:0-16") + end + def test_constant_or_writes index(<<~RUBY) FOO ||= 1 diff --git a/lib/ruby_indexer/test/instance_variables_test.rb b/lib/ruby_indexer/test/instance_variables_test.rb index 1bf14a857..2422bd119 100644 --- a/lib/ruby_indexer/test/instance_variables_test.rb +++ b/lib/ruby_indexer/test/instance_variables_test.rb @@ -25,6 +25,18 @@ def initialize assert_equal("Foo::Bar", owner.name) end + def test_instance_variable_with_multibyte_characters + index(<<~RUBY) + class Foo + def initialize + @あ = 1 + end + end + RUBY + + assert_entry("@あ", Entry::InstanceVariable, "/fake/path/foo.rb:2-4:2-6") + end + def test_instance_variable_and_write index(<<~RUBY) module Foo diff --git a/lib/ruby_indexer/test/method_test.rb b/lib/ruby_indexer/test/method_test.rb index 67c898963..ca9bb1282 100644 --- a/lib/ruby_indexer/test/method_test.rb +++ b/lib/ruby_indexer/test/method_test.rb @@ -27,6 +27,16 @@ def bar assert_entry("bar", Entry::Method, "/fake/path/foo.rb:1-2:2-5") end + def test_method_with_multibyte_characters + index(<<~RUBY) + class Foo + def こんにちは; end + end + RUBY + + assert_entry("こんにちは", Entry::Method, "/fake/path/foo.rb:1-2:1-16") + end + def test_singleton_method_using_self_receiver index(<<~RUBY) class Foo From 63df3c13137f59881bc87be0540e7ed16eb4c8d4 Mon Sep 17 00:00:00 2001 From: "NotFounds(Iori IKEDA)" Date: Tue, 24 Sep 2024 18:41:04 +0900 Subject: [PATCH 2/4] Modify to consider encoding in indexing --- .../lib/ruby_indexer/configuration.rb | 4 + .../lib/ruby_indexer/declaration_listener.rb | 74 +++++++++++++++-- lib/ruby_indexer/lib/ruby_indexer/entry.rb | 80 +++++++++++-------- lib/ruby_indexer/lib/ruby_indexer/index.rb | 5 +- .../lib/ruby_indexer/rbs_indexer.rb | 18 ++++- lib/ruby_lsp/global_state.rb | 1 + 6 files changed, 137 insertions(+), 45 deletions(-) diff --git a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb index 330c64b70..eee3fd2e8 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb @@ -19,9 +19,13 @@ class Configuration sig { params(workspace_path: String).void } attr_writer :workspace_path + sig { returns(Encoding) } + attr_accessor :encoding + sig { void } def initialize @workspace_path = T.let(Dir.pwd, String) + @encoding = T.let(Encoding::UTF_8, Encoding) @excluded_gems = T.let(initial_excluded_gems, T::Array[String]) @included_gems = T.let([], T::Array[String]) @excluded_patterns = T.let([File.join("**", "*_test.rb"), File.join("tmp", "**", "*")], T::Array[String]) diff --git a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb index 88c0bcca8..66a962cad 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb @@ -109,6 +109,7 @@ def on_class_node_enter(node) node.location, constant_path.location, comments, + @index.configuration.encoding, parent_class, ) @@ -132,7 +133,14 @@ def on_module_node_enter(node) comments = collect_comments(node) - entry = Entry::Module.new(actual_nesting(name), @file_path, node.location, constant_path.location, comments) + entry = Entry::Module.new( + actual_nesting(name), + @file_path, + node.location, + constant_path.location, + comments, + @index.configuration.encoding, + ) @owner_stack << entry @index.add(entry) @@ -161,7 +169,12 @@ def on_singleton_class_node_enter(node) if existing_entries entry = T.must(existing_entries.first) - entry.update_singleton_information(node.location, expression.location, collect_comments(node)) + entry.update_singleton_information( + node.location, + expression.location, + collect_comments(node), + @index.configuration.encoding, + ) else entry = Entry::SingletonClass.new( real_nesting, @@ -169,6 +182,7 @@ def on_singleton_class_node_enter(node) node.location, expression.location, collect_comments(node), + @index.configuration.encoding, nil, ) @index.add(entry, skip_prefix_tree: true) @@ -329,6 +343,7 @@ def on_def_node_enter(node) node.location, node.name_loc, comments, + @index.configuration.encoding, [Entry::Signature.new(list_params(node.parameters))], current_visibility, @owner_stack.last, @@ -345,6 +360,7 @@ def on_def_node_enter(node) node.location, node.name_loc, comments, + @index.configuration.encoding, [Entry::Signature.new(list_params(node.parameters))], current_visibility, singleton, @@ -403,6 +419,7 @@ def on_alias_method_node_enter(node) @file_path, node.new_name.location, comments, + @index.configuration.encoding, ), ) end @@ -433,7 +450,14 @@ def handle_instance_variable(node, loc) owner = @index.existing_or_new_singleton_class(owner.name) end - @index.add(Entry::InstanceVariable.new(name, @file_path, loc, collect_comments(node), owner)) + @index.add(Entry::InstanceVariable.new( + name, + @file_path, + loc, + collect_comments(node), + @index.configuration.encoding, + owner, + )) end sig { params(node: Prism::CallNode).void } @@ -496,6 +520,7 @@ def handle_alias_method(node) @file_path, new_name.location, comments, + @index.configuration.encoding, ), ) end @@ -525,19 +550,43 @@ def add_constant(node, name, value = nil) @index.add( case value when Prism::ConstantReadNode, Prism::ConstantPathNode - Entry::UnresolvedConstantAlias.new(value.slice, @stack.dup, name, @file_path, node.location, comments) + Entry::UnresolvedConstantAlias.new( + value.slice, + @stack.dup, + name, + @file_path, + node.location, + comments, + @index.configuration.encoding, + ) when Prism::ConstantWriteNode, Prism::ConstantAndWriteNode, Prism::ConstantOrWriteNode, Prism::ConstantOperatorWriteNode # If the right hand side is another constant assignment, we need to visit it because that constant has to be # indexed too - Entry::UnresolvedConstantAlias.new(value.name.to_s, @stack.dup, name, @file_path, node.location, comments) + Entry::UnresolvedConstantAlias.new( + value.name.to_s, + @stack.dup, + name, + @file_path, + node.location, + comments, + @index.configuration.encoding, + ) when Prism::ConstantPathWriteNode, Prism::ConstantPathOrWriteNode, Prism::ConstantPathOperatorWriteNode, Prism::ConstantPathAndWriteNode - Entry::UnresolvedConstantAlias.new(value.target.slice, @stack.dup, name, @file_path, node.location, comments) + Entry::UnresolvedConstantAlias.new( + value.target.slice, + @stack.dup, + name, + @file_path, + node.location, + comments, + @index.configuration.encoding, + ) else - Entry::Constant.new(name, @file_path, node.location, comments) + Entry::Constant.new(name, @file_path, node.location, comments, @index.configuration.encoding) end, ) end @@ -600,7 +649,15 @@ def handle_attribute(node, reader:, writer:) next unless name && loc if reader - @index.add(Entry::Accessor.new(name, @file_path, loc, comments, current_visibility, @owner_stack.last)) + @index.add(Entry::Accessor.new( + name, + @file_path, + loc, + comments, + @index.configuration.encoding, + current_visibility, + @owner_stack.last, + )) end next unless writer @@ -610,6 +667,7 @@ def handle_attribute(node, reader:, writer:) @file_path, loc, comments, + @index.configuration.encoding, current_visibility, @owner_stack.last, )) diff --git a/lib/ruby_indexer/lib/ruby_indexer/entry.rb b/lib/ruby_indexer/lib/ruby_indexer/entry.rb index 5d6a19459..63da66ae3 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/entry.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/entry.rb @@ -33,9 +33,10 @@ class Visibility < T::Enum file_path: String, location: T.any(Prism::Location, RubyIndexer::Location), comments: T.nilable(String), + encoding: Encoding, ).void end - def initialize(name, file_path, location, comments) + def initialize(name, file_path, location, comments, encoding) @name = name @file_path = file_path @comments = comments @@ -46,8 +47,8 @@ def initialize(name, file_path, location, comments) Location.new( location.start_line, location.end_line, - location.start_column, - location.end_column, + location.start_code_units_column(encoding), + location.end_code_units_column(encoding), ) else location @@ -150,22 +151,23 @@ class Namespace < Entry location: T.any(Prism::Location, RubyIndexer::Location), name_location: T.any(Prism::Location, Location), comments: T.nilable(String), + encoding: Encoding, ).void end - def initialize(nesting, file_path, location, name_location, comments) + def initialize(nesting, file_path, location, name_location, comments, encoding) # rubocop:disable Metrics/ParameterLists @name = T.let(nesting.join("::"), String) # The original nesting where this namespace was discovered @nesting = nesting - super(@name, file_path, location, comments) + super(@name, file_path, location, comments, encoding) @name_location = T.let( if name_location.is_a?(Prism::Location) Location.new( name_location.start_line, name_location.end_line, - name_location.start_column, - name_location.end_column, + name_location.start_code_units_column(encoding), + name_location.end_code_units_column(encoding), ) else name_location @@ -211,11 +213,12 @@ class Class < Namespace location: T.any(Prism::Location, RubyIndexer::Location), name_location: T.any(Prism::Location, Location), comments: T.nilable(String), + encoding: Encoding, parent_class: T.nilable(String), ).void end - def initialize(nesting, file_path, location, name_location, comments, parent_class) # rubocop:disable Metrics/ParameterLists - super(nesting, file_path, location, name_location, comments) + def initialize(nesting, file_path, location, name_location, comments, encoding, parent_class) # rubocop:disable Metrics/ParameterLists + super(nesting, file_path, location, name_location, comments, encoding) @parent_class = parent_class end @@ -228,20 +231,27 @@ def ancestor_hash class SingletonClass < Class extend T::Sig - sig { params(location: Prism::Location, name_location: Prism::Location, comments: T.nilable(String)).void } - def update_singleton_information(location, name_location, comments) + sig do + params( + location: Prism::Location, + name_location: Prism::Location, + comments: T.nilable(String), + encoding: Encoding, + ).void + end + def update_singleton_information(location, name_location, comments, encoding) # Create a new RubyIndexer::Location object from the Prism location @location = Location.new( location.start_line, location.end_line, - location.start_column, - location.end_column, + location.start_code_units_column(encoding), + location.end_code_units_column(encoding), ) @name_location = Location.new( name_location.start_line, name_location.end_line, - name_location.start_column, - name_location.end_column, + name_location.start_code_units_column(encoding), + name_location.end_code_units_column(encoding), ) (@comments ||= +"") << comments if comments end @@ -361,12 +371,13 @@ class Member < Entry file_path: String, location: T.any(Prism::Location, RubyIndexer::Location), comments: T.nilable(String), + encoding: Encoding, visibility: Visibility, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, comments, visibility, owner) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments) + def initialize(name, file_path, location, comments, encoding, visibility, owner) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments, encoding) @visibility = visibility @owner = owner end @@ -429,21 +440,22 @@ class Method < Member location: T.any(Prism::Location, RubyIndexer::Location), name_location: T.any(Prism::Location, Location), comments: T.nilable(String), + encoding: Encoding, signatures: T::Array[Signature], visibility: Visibility, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, name_location, comments, signatures, visibility, owner) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments, visibility, owner) + def initialize(name, file_path, location, name_location, comments, encoding, signatures, visibility, owner) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments, encoding, visibility, owner) @signatures = signatures @name_location = T.let( if name_location.is_a?(Prism::Location) Location.new( name_location.start_line, name_location.end_line, - name_location.start_column, - name_location.end_column, + name_location.start_code_units_column(encoding), + name_location.end_code_units_column(encoding), ) else name_location @@ -480,10 +492,11 @@ class UnresolvedConstantAlias < Entry file_path: String, location: T.any(Prism::Location, RubyIndexer::Location), comments: T.nilable(String), + encoding: Encoding, ).void end - def initialize(target, nesting, name, file_path, location, comments) # rubocop:disable Metrics/ParameterLists - super(name, file_path, location, comments) + def initialize(target, nesting, name, file_path, location, comments, encoding) # rubocop:disable Metrics/ParameterLists + super(name, file_path, location, comments, encoding) @target = target @nesting = nesting @@ -497,9 +510,9 @@ class ConstantAlias < Entry sig { returns(String) } attr_reader :target - sig { params(target: String, unresolved_alias: UnresolvedConstantAlias).void } - def initialize(target, unresolved_alias) - super(unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments) + sig { params(target: String, unresolved_alias: UnresolvedConstantAlias, encoding: Encoding).void } + def initialize(target, unresolved_alias, encoding) + super(unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments, encoding) @visibility = unresolved_alias.visibility @target = target @@ -517,11 +530,12 @@ class InstanceVariable < Entry file_path: String, location: T.any(Prism::Location, RubyIndexer::Location), comments: T.nilable(String), + encoding: Encoding, owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, comments, owner) - super(name, file_path, location, comments) + def initialize(name, file_path, location, comments, encoding, owner) + super(name, file_path, location, comments, encoding) @owner = owner end end @@ -546,10 +560,11 @@ class UnresolvedMethodAlias < Entry file_path: String, location: T.any(Prism::Location, RubyIndexer::Location), comments: T.nilable(String), + encoding: Encoding, ).void end - def initialize(new_name, old_name, owner, file_path, location, comments) # rubocop:disable Metrics/ParameterLists - super(new_name, file_path, location, comments) + def initialize(new_name, old_name, owner, file_path, location, comments, encoding) # rubocop:disable Metrics/ParameterLists + super(new_name, file_path, location, comments, encoding) @new_name = new_name @old_name = old_name @@ -567,8 +582,8 @@ class MethodAlias < Entry sig { returns(T.nilable(Entry::Namespace)) } attr_reader :owner - sig { params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias).void } - def initialize(target, unresolved_alias) + sig { params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias, encoding: Encoding).void } + def initialize(target, unresolved_alias, encoding) full_comments = +"Alias for #{target.name}\n" full_comments << "#{unresolved_alias.comments}\n" full_comments << target.comments @@ -578,6 +593,7 @@ def initialize(target, unresolved_alias) unresolved_alias.file_path, unresolved_alias.location, full_comments, + encoding ) @target = target diff --git a/lib/ruby_indexer/lib/ruby_indexer/index.rb b/lib/ruby_indexer/lib/ruby_indexer/index.rb index 9fcbd6e7c..e132d8544 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/index.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/index.rb @@ -665,6 +665,7 @@ def existing_or_new_singleton_class(name) attached_ancestor.location, attached_ancestor.name_location, nil, + @configuration.encoding, nil, ) add(singleton, skip_prefix_tree: true) @@ -856,7 +857,7 @@ def resolve_alias(entry, seen_names) return entry unless target target_name = T.must(target.first).name - resolved_alias = Entry::ConstantAlias.new(target_name, entry) + resolved_alias = Entry::ConstantAlias.new(target_name, entry, @configuration.encoding) # Replace the UnresolvedAlias by a resolved one so that we don't have to do this again later original_entries = T.must(@entries[alias_name]) @@ -1047,7 +1048,7 @@ def resolve_method_alias(entry, receiver_name, seen_names) target_method_entries = resolve_method(entry.old_name, receiver_name, seen_names) return entry unless target_method_entries - resolved_alias = Entry::MethodAlias.new(T.must(target_method_entries.first), entry) + resolved_alias = Entry::MethodAlias.new(T.must(target_method_entries.first), entry, @configuration.encoding) original_entries = T.must(@entries[new_name]) original_entries.delete(entry) original_entries << resolved_alias diff --git a/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb b/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb index 5b845c60f..3f6683272 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb @@ -57,9 +57,9 @@ def handle_class_or_module_declaration(declaration, pathname) comments = comments_to_string(declaration) entry = if declaration.is_a?(RBS::AST::Declarations::Class) parent_class = declaration.super_class&.name&.name&.to_s - Entry::Class.new(nesting, file_path, location, location, comments, parent_class) + Entry::Class.new(nesting, file_path, location, location, comments, @index.configuration.encoding, parent_class) else - Entry::Module.new(nesting, file_path, location, location, comments) + Entry::Module.new(nesting, file_path, location, location, comments, @index.configuration.encoding) end add_declaration_mixins_to_entry(declaration, entry) @index.add(entry) @@ -126,7 +126,17 @@ def handle_method(member, owner) real_owner = member.singleton? ? @index.existing_or_new_singleton_class(owner.name) : owner signatures = signatures(member) - @index.add(Entry::Method.new(name, file_path, location, location, comments, signatures, visibility, real_owner)) + @index.add(Entry::Method.new( + name, + file_path, + location, + location, + comments, + @index.configuration.encoding, + signatures, + visibility, + real_owner, + )) end sig { params(member: RBS::AST::Members::MethodDefinition).returns(T::Array[Entry::Signature]) } @@ -245,6 +255,7 @@ def handle_constant(declaration, nesting, file_path) file_path, to_ruby_indexer_location(declaration.location), comments_to_string(declaration), + @index.configuration.encoding, )) end @@ -260,6 +271,7 @@ def handle_signature_alias(member, owner_entry) file_path, to_ruby_indexer_location(member.location), comments, + @index.configuration.encoding, ) @index.add(entry) diff --git a/lib/ruby_lsp/global_state.rb b/lib/ruby_lsp/global_state.rb index 0149a61f2..b7d5da002 100644 --- a/lib/ruby_lsp/global_state.rb +++ b/lib/ruby_lsp/global_state.rb @@ -117,6 +117,7 @@ def apply_options(options) else Encoding::UTF_32 end + @index.configuration.encoding = @encoding file_watching_caps = options.dig(:capabilities, :workspace, :didChangeWatchedFiles) if file_watching_caps&.dig(:dynamicRegistration) && file_watching_caps&.dig(:relativePatternSupport) From 57f4f9fdfa42ef3f5cf77f176771336cfbe5ace5 Mon Sep 17 00:00:00 2001 From: "NotFounds(Iori IKEDA)" Date: Thu, 26 Sep 2024 09:20:55 +0900 Subject: [PATCH 3/4] Fix type error --- lib/ruby_indexer/test/enhancements_test.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ruby_indexer/test/enhancements_test.rb b/lib/ruby_indexer/test/enhancements_test.rb index cf23a6adf..0a30c6fa3 100644 --- a/lib/ruby_indexer/test/enhancements_test.rb +++ b/lib/ruby_indexer/test/enhancements_test.rb @@ -39,6 +39,7 @@ def on_call_node(index, owner, node, file_path) location, location, nil, + index.configuration.encoding, [Entry::Signature.new([Entry::RequiredParameter.new(name: :a)])], Entry::Visibility::PUBLIC, owner, @@ -121,6 +122,7 @@ def on_call_node(index, owner, node, file_path) location, location, nil, + index.configuration.encoding, [], Entry::Visibility::PUBLIC, owner, From d15ede601e629ddcd4443f9d3043e7e91b900d10 Mon Sep 17 00:00:00 2001 From: "NotFounds(Iori IKEDA)" Date: Thu, 26 Sep 2024 09:25:15 +0900 Subject: [PATCH 4/4] Format code --- lib/ruby_indexer/lib/ruby_indexer/entry.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ruby_indexer/lib/ruby_indexer/entry.rb b/lib/ruby_indexer/lib/ruby_indexer/entry.rb index 63da66ae3..291f5dcdf 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/entry.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/entry.rb @@ -512,7 +512,13 @@ class ConstantAlias < Entry sig { params(target: String, unresolved_alias: UnresolvedConstantAlias, encoding: Encoding).void } def initialize(target, unresolved_alias, encoding) - super(unresolved_alias.name, unresolved_alias.file_path, unresolved_alias.location, unresolved_alias.comments, encoding) + super( + unresolved_alias.name, + unresolved_alias.file_path, + unresolved_alias.location, + unresolved_alias.comments, + encoding + ) @visibility = unresolved_alias.visibility @target = target @@ -534,7 +540,7 @@ class InstanceVariable < Entry owner: T.nilable(Entry::Namespace), ).void end - def initialize(name, file_path, location, comments, encoding, owner) + def initialize(name, file_path, location, comments, encoding, owner) # rubocop:disable Metrics/ParameterLists super(name, file_path, location, comments, encoding) @owner = owner end @@ -582,7 +588,9 @@ class MethodAlias < Entry sig { returns(T.nilable(Entry::Namespace)) } attr_reader :owner - sig { params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias, encoding: Encoding).void } + sig do + params(target: T.any(Member, MethodAlias), unresolved_alias: UnresolvedMethodAlias, encoding: Encoding).void + end def initialize(target, unresolved_alias, encoding) full_comments = +"Alias for #{target.name}\n" full_comments << "#{unresolved_alias.comments}\n"