module Solargraph::Pin::Localized

def match_tags tag1, tag2

Returns:
  • (Boolean) -

Parameters:
  • tag2 (String) --
  • tag1 (String) --
def match_tags tag1, tag2
  # @todo This is an unfortunate hack made necessary by a discrepancy in

  #   how tags indicate the root namespace. The long-term solution is to

  #   standardize it, whether it's `Class<>`, an empty string, or

  #   something else.

  tag1 == tag2 ||
    (['', 'Class<>'].include?(tag1) && ['', 'Class<>'].include?(tag2))
end

def visible_at?(other_loc)

Parameters:
  • other_loc (Location) --
def visible_at?(other_loc)
  return false if location.filename != other_loc.filename
  presence.include?(other_loc.range.start)
end

def visible_from?(other, position)

Returns:
  • (Boolean) -

Parameters:
  • position (Position, Array(Integer, Integer)) -- The caller's position
  • other (Pin::Base) -- The caller's block
def visible_from?(other, position)
  position = Position.normalize(position)
  other.filename == filename &&
    match_tags(other.full_context.tag, full_context.tag) &&
    (other == closure ||
      (closure.location.range.contain?(other.location.range.start) && closure.location.range.contain?(other.location.range.ending))
    ) &&
    presence.contain?(position)
end