         let extensionNames = namer.messagePropertyNames(extensionField: fieldDescriptor)
         let defaultValue = fieldDescriptor.swiftDefaultValue(namer: namer)
 
-        p.print("\n")
-        p.print("extension \(containingTypeSwiftFullName) {\n")
-        p.indent()
-        p.print(
+        // ExtensionGenerator.Set provides the context to write out the properties.
+
+        p.print(
+          "\n",
           comments,
           "\(visibility)var \(extensionNames.value): \(apiType) {\n")
         p.indent()

        }

        func generateMessageSwiftExtensions(printer p: inout CodePrinter) {
            for e in extensions {
                e.generateMessageSwiftExtension(printer: &p)
            }
        }

        func generateFileProtobufExtensionRegistry(printer p: inout CodePrinter) {

        p.print("clearExtensionValue(ext: \(swiftFullExtensionName))\n")
        p.outdent()
        p.print("}\n")
    }
}
