lib/ruby_indexer/lib/ruby_indexer/entry.rb in ruby-lsp-0.16.4 vs lib/ruby_indexer/lib/ruby_indexer/entry.rb in ruby-lsp-0.16.5
- old
+ new
@@ -9,26 +9,46 @@
attr_reader :name
sig { returns(String) }
attr_reader :file_path
- sig { returns(Prism::Location) }
+ sig { returns(RubyIndexer::Location) }
attr_reader :location
sig { returns(T::Array[String]) }
attr_reader :comments
sig { returns(Symbol) }
attr_accessor :visibility
- sig { params(name: String, file_path: String, location: Prism::Location, comments: T::Array[String]).void }
+ sig do
+ params(
+ name: String,
+ file_path: String,
+ location: T.any(Prism::Location, RubyIndexer::Location),
+ comments: T::Array[String],
+ ).void
+ end
def initialize(name, file_path, location, comments)
@name = name
@file_path = file_path
- @location = location
@comments = comments
@visibility = T.let(:public, Symbol)
+
+ @location = T.let(
+ if location.is_a?(Prism::Location)
+ Location.new(
+ location.start_line,
+ location.end_line,
+ location.start_column,
+ location.end_column,
+ )
+ else
+ location
+ end,
+ RubyIndexer::Location,
+ )
end
sig { returns(String) }
def file_name
File.basename(@file_path)
@@ -48,11 +68,11 @@
sig do
params(
name: String,
file_path: String,
- location: Prism::Location,
+ location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
).void
end
def initialize(name, file_path, location, comments)
super(name, file_path, location, comments)
@@ -79,11 +99,11 @@
sig do
params(
name: String,
file_path: String,
- location: Prism::Location,
+ location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
parent_class: T.nilable(String),
).void
end
def initialize(name, file_path, location, comments, parent_class)
@@ -179,11 +199,11 @@
sig do
params(
name: String,
file_path: String,
- location: Prism::Location,
+ location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
owner: T.nilable(Entry::Namespace),
).void
end
def initialize(name, file_path, location, comments, owner)
@@ -217,11 +237,11 @@
sig do
params(
name: String,
file_path: String,
- location: Prism::Location,
+ location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
parameters_node: T.nilable(Prism::ParametersNode),
owner: T.nilable(Entry::Namespace),
).void
end
@@ -347,10 +367,10 @@
params(
target: String,
nesting: T::Array[String],
name: String,
file_path: String,
- location: Prism::Location,
+ location: T.any(Prism::Location, RubyIndexer::Location),
comments: T::Array[String],
).void
end
def initialize(target, nesting, name, file_path, location, comments) # rubocop:disable Metrics/ParameterLists
super(name, file_path, location, comments)