class Solargraph::Diagnostics::RequireNotFound
RequireNotFound
reports required paths that could not be resolved to either a file in the workspace or a gem.
Public Instance Methods
diagnose(source, api_map)
click to toggle source
# File lib/solargraph/diagnostics/require_not_found.rb, line 9 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.missing_docs.each do |r| next unless refs.key?(r) result.push docs_error(r, refs[r].location) end api_map.unresolved_requires.each do |r| next unless refs.key?(r) result.push require_error(r, refs[r].location) end result end
Private Instance Methods
docs_error(path, location)
click to toggle source
@param path [String] @param location [Location] @return [Hash]
# File lib/solargraph/diagnostics/require_not_found.rb, line 31 def docs_error path, location { range: location.range.to_hash, severity: Diagnostics::Severities::WARNING, source: 'RequireNotFound', message: "YARD docs not found for #{path}" } end
require_error(path, location)
click to toggle source
@param path [String] @param location [Location] @return [Hash]
# File lib/solargraph/diagnostics/require_not_found.rb, line 43 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