class RubyLsp::Requests::Support::RuboCopDiagnostic

def to_lsp_diagnostic(config)

: (::RuboCop::Config config) -> Interface::Diagnostic
def to_lsp_diagnostic(config)
  # highlighted_area contains the begin and end position of the first line
  # This ensures that multiline offenses don't clutter the editor
  highlighted = @offense.highlighted_area
  Interface::Diagnostic.new(
    message: message,
    source: "RuboCop",
    code: @offense.cop_name,
    code_description: code_description(config),
    severity: severity,
    range: Interface::Range.new(
      start: Interface::Position.new(
        line: @offense.line - 1,
        character: highlighted.begin_pos,
      ),
      end: Interface::Position.new(
        line: @offense.line - 1,
        character: highlighted.end_pos,
      ),
    ),
    data: {
      correctable: correctable?,
      code_actions: to_lsp_code_actions,
    },
  )
end