class Solargraph::LanguageServer::Message::TextDocument::Formatting

def process

def process
  file_uri = params['textDocument']['uri']
  config = config_for(file_uri)
  original = host.read_text(file_uri)
  args = cli_args(file_uri, config)
  require_rubocop(config['version'])
  options, paths = ::RuboCop::Options.new.parse(args)
  options[:stdin] = original
  corrections = redirect_stdout do
    ::RuboCop::Runner.new(options, ::RuboCop::ConfigStore.new).run(paths)
  end
  result = options[:stdin]
  log_corrections(corrections)
  format original, result
rescue ::RuboCop::ValidationError, ::RuboCop::ConfigNotFoundError => e
  set_error(Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}")
end