Class: SolargraphSyntaxSuggest::SyntaxSuggestReporter

Inherits:
Solargraph::Diagnostics::Base
  • Object
show all
Defined in:
lib/solargraph_syntax_suggest/syntax_suggest_reporter.rb

Instance Method Summary collapse

Instance Method Details

#diagnose(source, _api_map) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/solargraph_syntax_suggest/syntax_suggest_reporter.rb', line 5

def diagnose(source, _api_map)
  io = StringIO.new
  ::SyntaxSuggest.call(source: source.code, io:)

  line_numbers(io).map do
    diagnostic_message_for_line(
      line: _1,
      message: io.string.lines.first.chomp,
      length: source.code.lines[_1].length
    )
  end
end