class Steep::Server::CodeWorker

def handle_request(request)

def handle_request(request)
  case request[:method]
  when "initialize"
    # Don't respond to initialize request, but start type checking.
    project.targets.each do |target|
      target.source_files.each_key do |path|
        if target_files.key?(path)
          enqueue_type_check(target: target, path: path, version: target_files[path])
        end
      end
    end
  when "workspace/executeCommand"
    if request[:params][:command] == "steep/registerSourceToWorker"
      paths = request[:params][:arguments].map {|arg| source_path(URI.parse(arg)) }
      paths.each do |path|
        target_files[path] = 0
      end
    end
  when "textDocument/didChange"
    update_source(request) do |path, version|
      if target_files.key?(path)
        target_files[path] = version
      end
    end
    path = source_path(URI.parse(request[:params][:textDocument][:uri]))
    version = request[:params][:textDocument][:version]
    each_type_check_subject(path: path, version: version) do |target, path, version|
      enqueue_type_check(target: target, path: path, version: version)
    end
  end
end