docs: def setup(app):
      """Register the extension with Sphinx.
  
      Args:
          app: The Sphinx application.
      """
  
      for name, (default, rebuild, _) in ref.CONFIG_VALUES.iteritems():
          app.add_config_value(name, default, rebuild)
  
      app.add_directive('javaimport', ref.JavarefImportDirective)
      app.add_role('javaref', ref.JavarefRole(app))
  
      app.connect('builder-inited', initialize_env)
      app.connect('env-purge-doc', ref.purge_imports)
      app.connect('env-merge-info', ref.merge_imports)
      app.connect('build-finished', ref.cleanup)