class Solargraph::Diagnostics::RequireNotFound


either a file in the workspace or a gem.
RequireNotFound reports required paths that could not be resolved to

def diagnose source, api_map

def diagnose source, api_map
  return [] unless source.parsed? && source.synchronized?
  result = []
  refs = {}
  map = api_map.source_map(source.filename)
  map.requires.each { |ref| refs[ref.name] = ref }
  api_map.unresolved_requires.each do |r|
    next unless refs.key?(r)
    result.push require_error(r, refs[r].location)
  end
  result
end

def require_error path, location

Returns:
  • (Hash) -

Parameters:
  • location (Location) --
  • path (String) --
def require_error path, location
  {
    range: location.range.to_hash,
    severity: Diagnostics::Severities::WARNING,
    source: 'RequireNotFound',
    message: "Required path #{path} could not be resolved."
  }
end