module Solargraph::Pin::YardPin::YardMixin

def comments

def comments
  @comments ||= code_object.docstring ? code_object.docstring.all : ''
end

def location

def location
  # Guarding with @located because nil locations are valid

  return @location if @located
  @located = true
  @location = object_location
end

def object_location

Returns:
  • (Solargraph::Location, nil) -
def object_location
  return nil if spec.nil? || code_object.nil? || code_object.file.nil? || code_object.line.nil?
  file = File.join(spec.full_gem_path, code_object.file)
  Solargraph::Location.new(file, Solargraph::Range.from_to(code_object.line - 1, 0, code_object.line - 1, 0))
end