class Standard::Lsp::Standardizer

def format(path, text)

def format(path, text)
  @format_runner.run(path, text)
  @format_runner.formatted_source
end

def initialize(config)

def initialize(config)
  @diagnostic_runner = ::Standard::Lsp::StdinRubocopRunner.new(config)
  @format_runner = ::Standard::Lsp::StdinRubocopRunner.new(config.dup.tap { |c|
    c.rubocop_options[:autocorrect] = true
  })
  @cop_registry = RuboCop::Cop::Registry.global.to_h
end

def offenses(path, text, document_encoding = nil)

def offenses(path, text, document_encoding = nil)
  @diagnostic_runner.run(path, text)
  @diagnostic_runner.offenses.map do |offense|
    Diagnostic.new(
      document_encoding,
      offense,
      path,
      @cop_registry[offense.cop_name]&.first
    ).to_lsp_diagnostic(@diagnostic_runner.config_for_working_directory)
  end
end