Module: Solargraph::Pin::Localized

Included in:
LocalVariable
Defined in:
lib/solargraph/pin/localized.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#presenceRange (readonly)

Returns:



7
8
9
# File 'lib/solargraph/pin/localized.rb', line 7

def presence
  @presence
end

Instance Method Details

#visible_at?(other_loc) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


23
24
25
26
# File 'lib/solargraph/pin/localized.rb', line 23

def visible_at?(other_loc)
  return false if location.filename != other_loc.filename
  presence.include?(other_loc.range.start)
end

#visible_from?(other, position) ⇒ Boolean

Parameters:

  • other (Pin::Base)

    The caller’s block

  • position (Position, Array(Integer, Integer))

    The caller’s position

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
# File 'lib/solargraph/pin/localized.rb', line 12

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