Class: Solargraph::Diagnostics::RequireNotFound
- Defined in:
- lib/solargraph/diagnostics/require_not_found.rb
Overview
RequireNotFound reports required paths that could not be resolved to either a file in the workspace or a gem.
Instance Method Summary collapse
Instance Method Details
#diagnose(source, api_map) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/solargraph/diagnostics/require_not_found.rb', line 7 def diagnose source, api_map result = [] refs = {} map = Solargraph::SourceMap.map(source) map.requires.each do |ref| refs[ref.name] = ref end api_map.unresolved_requires.each do |r| next unless refs.has_key?(r) result.push( range: refs[r].location.range.to_hash, severity: Diagnostics::Severities::WARNING, source: 'Solargraph', message: "Required path #{r} could not be resolved." ) end result end |