Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Oct 4, 2024
1 parent fed6be1 commit cb33d2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/ruby_indexer/lib/ruby_indexer/reference_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ class Target
class ConstTarget < Target
extend T::Sig

sig { returns(String) }
attr_reader :fully_qualified_name

sig { params(fully_qualified_name: String).void }
def initialize(fully_qualified_name)
super()
@fully_qualified_name = fully_qualified_name
end

sig { returns(String) }
attr_reader :fully_qualified_name
end

class MethodTarget < Target
extend T::Sig

sig { returns(String) }
attr_reader :method_name

sig { params(method_name: String).void }
def initialize(method_name)
super()
@method_name = method_name
end

sig { returns(String) }
attr_reader :method_name
end

class Reference
Expand Down
10 changes: 5 additions & 5 deletions lib/ruby_lsp/requests/references.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def perform

sig do
params(
target: T.any(
target_node: T.any(
Prism::ConstantReadNode,
Prism::ConstantPathNode,
Prism::ConstantPathTargetNode,
Expand All @@ -100,10 +100,10 @@ def perform
node_context: NodeContext,
).returns(T.nilable(RubyIndexer::ReferenceFinder::Target))
end
def create_reference_target(target, node_context)
case target
def create_reference_target(target_node, node_context)
case target_node
when Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::ConstantPathTargetNode
name = constant_name(target)
name = constant_name(target_node)
return unless name

entries = @global_state.index.resolve(name, node_context.nesting)
Expand All @@ -112,7 +112,7 @@ def create_reference_target(target, node_context)
fully_qualified_name = T.must(entries.first).name
RubyIndexer::ReferenceFinder::ConstTarget.new(fully_qualified_name)
when Prism::CallNode, Prism::DefNode
RubyIndexer::ReferenceFinder::MethodTarget.new(target.name.to_s)
RubyIndexer::ReferenceFinder::MethodTarget.new(target_node.name.to_s)
end
end

Expand Down

0 comments on commit cb33d2d

Please sign in to comment.